Browse Source

kdelibs update to Trinity v3.5.11

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1061230 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
tags/v3.5.13
tpearson 9 years ago
parent
commit
865f314dd5
100 changed files with 1146 additions and 652 deletions
  1. 1
    1
      Makefile.am.in
  2. 1
    1
      arts/kde/Makefile.am
  3. 1
    1
      arts/knotify/Makefile.am
  4. 4
    2
      configure.in.in
  5. 1
    1
      dcop/Makefile.am
  6. 4
    3
      dcop/dcopidlng/dcopidlng
  7. 2
    2
      dnssd/Makefile.am
  8. 3
    4
      dnssd/README
  9. 14
    35
      dnssd/configure.in.in
  10. 45
    30
      dnssd/domainbrowser.cpp
  11. 121
    71
      dnssd/publicservice.cpp
  12. 5
    0
      dnssd/publicservice.h
  13. 89
    43
      dnssd/query.cpp
  14. 53
    52
      dnssd/remoteservice.cpp
  15. 33
    42
      dnssd/responder.cpp
  16. 14
    20
      dnssd/responder.h
  17. 4
    5
      dnssd/sdevent.h
  18. 1
    1
      dnssd/servicebase.cpp
  19. 7
    18
      dnssd/servicebrowser.cpp
  20. 1
    1
      interfaces/kimproxy/library/Makefile.am
  21. 1
    1
      interfaces/kmediaplayer/Makefile.am
  22. 1
    1
      interfaces/kmediaplayer/kfileaudiopreview/Makefile.am
  23. 1
    1
      interfaces/kscript/Makefile.am
  24. 1
    1
      interfaces/kscript/sample/Makefile.am
  25. 1
    1
      interfaces/ktexteditor/Makefile.am
  26. 2
    0
      interfaces/terminal/kde_terminal_interface.h
  27. 1
    1
      kabc/Makefile.am
  28. 1
    1
      kabc/formats/Makefile.am
  29. 2
    2
      kabc/plugins/dir/Makefile.am
  30. 2
    2
      kabc/plugins/file/Makefile.am
  31. 2
    2
      kabc/plugins/ldapkio/Makefile.am
  32. 1
    1
      kabc/vcard/Makefile.am
  33. 5
    1
      kate/data/Makefile.am
  34. 1
    1
      kate/interfaces/Makefile.am
  35. 1
    1
      kate/part/Makefile.am
  36. 22
    10
      kate/part/katesearch.cpp
  37. 1
    1
      kate/plugins/insertfile/Makefile.am
  38. 1
    1
      kate/plugins/isearch/Makefile.am
  39. 1
    1
      kate/plugins/kdatatool/Makefile.am
  40. 1
    1
      kate/plugins/wordcompletion/Makefile.am
  41. 1
    1
      kcert/Makefile.am
  42. 1
    1
      kcmshell/Makefile.am
  43. 1
    1
      kconf_update/Makefile.am
  44. 9
    3
      kdecore/Makefile.am
  45. 3
    0
      kdecore/kaccel.cpp
  46. 51
    0
      kdecore/kconfigbackend.cpp
  47. 6
    0
      kdecore/kconfigbackend.h
  48. 1
    1
      kdecore/kcrash.cpp
  49. 2
    1
      kdecore/kdebug.cpp
  50. 1
    1
      kdecore/kdebugrc
  51. 2
    2
      kdecore/kdeversion.h
  52. 36
    15
      kdecore/kglobalsettings.cpp
  53. 148
    0
      kdecore/kiconeffect.cpp
  54. 1
    0
      kdecore/kiconeffect.h
  55. 1
    1
      kdecore/kicontheme.cpp
  56. 13
    4
      kdecore/klocale.cpp
  57. 114
    78
      kdecore/kpty.cpp
  58. 10
    0
      kdecore/kpty.h
  59. 9
    3
      kdecore/kstandarddirs.cpp
  60. 37
    1
      kdecore/kstartupinfo.cpp
  61. 24
    0
      kdecore/kstartupinfo.h
  62. 14
    3
      kdecore/netwm.cpp
  63. 1
    0
      kdecore/netwm_def.h
  64. 0
    3
      kdecore/network/kresolverworkerbase.cpp
  65. 3
    3
      kded/Makefile.am
  66. 20
    64
      kded/applications.menu
  67. 1
    1
      kded/kbuildservicefactory.cpp
  68. 15
    0
      kded/kded.cpp
  69. 3
    1
      kded/vfolder_menu.cpp
  70. 1
    1
      kdefx/Makefile.am
  71. 52
    0
      kdefx/kstyle.cpp
  72. 3
    3
      kdelibs.lsm
  73. 2
    2
      kdeprint/Makefile.am
  74. 3
    2
      kdeprint/configure.in.in
  75. 1
    1
      kdeprint/cups/Makefile.am
  76. 1
    1
      kdeprint/cups/cupsdconf2/Makefile.am
  77. 7
    7
      kdeprint/cups/cupsdconf2/cupsd.conf.template
  78. 3
    3
      kdeprint/cups/cupsdconf2/cupsdconf.cpp
  79. 3
    8
      kdeprint/cups/cupsdconf2/cupsddialog.cpp
  80. 1
    1
      kdeprint/cups/kmcupsmanager.cpp
  81. 1
    1
      kdeprint/ext/Makefile.am
  82. 9
    0
      kdeprint/filters/psnup.xml
  83. 1
    1
      kdeprint/kprinter.cpp
  84. 1
    1
      kdeprint/lpdunix/Makefile.am
  85. 2
    1
      kdeprint/lpr/Makefile.am
  86. 3
    3
      kdeprint/management/Makefile.am
  87. 8
    0
      kdeprint/management/kmmainview.cpp
  88. 1
    0
      kdeprint/management/kmmainview.h
  89. 9
    11
      kdeprint/management/smbview.cpp
  90. 1
    1
      kdeprint/rlpr/Makefile.am
  91. 1
    1
      kdeprint/tools/escputil/Makefile.am
  92. 2
    2
      kdesu/Makefile.am
  93. 3
    3
      kdeui/Makefile.am
  94. 2
    2
      kdeui/kaboutapplication.cpp
  95. 25
    27
      kdeui/kaboutkde.cpp
  96. 16
    14
      kdeui/kbugreport.cpp
  97. 1
    1
      kdeui/kbugreport.h
  98. 1
    1
      kdeui/kdetrayproxy/Makefile.am
  99. 1
    1
      kdeui/khelpmenu.cpp
  100. 0
    0
      kdeui/kiconview.cpp

+ 1
- 1
Makefile.am.in View File

@@ -18,7 +18,7 @@
# Boston, MA 02110-1301, USA.


COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio
COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post
COMPILE_BEFORE_doc = kdoctools
COMPILE_AFTER_kparts = kspell2 kmdi kdeprint kinit kate interfaces kcert khtml
COMPILE_AFTER_kdeprint = kate khtml

+ 1
- 1
arts/kde/Makefile.am View File

@@ -8,7 +8,7 @@ libartskde_la_SOURCES = artskde.cc kioinputstream_impl.cpp kplayobject.cc \
kartsserver.cpp kdatarequest_impl.cpp kaudioconverter.cc \
kvideowidget.cpp kplayobjectcreator.cc \
kaudiomanagerplay.cpp
libartskde_la_LIBADD = $(LIB_KIO) -lqtmcop -lsoundserver_idl
libartskde_la_LIBADD = $(LIB_KIO) -lqtmcop -lsoundserver_idl -lartsflow_idl -lmcop $(LIB_QT) $(LIB_KDECORE) -lkmedia2_idl -lartsflow $(LIB_KDEUI) $(LIB_X11)
libartskde_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 3:0:2
libartskde_la_METASOURCES = AUTO
libartskde_la_COMPILE_FIRST = artskde.h

+ 1
- 1
arts/knotify/Makefile.am View File

@@ -7,7 +7,7 @@ kde_module_LTLIBRARIES = knotify.la

knotify_la_SOURCES = knotify.cpp knotify.skel
if include_ARTS
knotify_la_LIBADD = -lsoundserver_idl -lqtmcop $(LIB_KDEUI) $(top_builddir)/arts/kde/libartskde.la
knotify_la_LIBADD = -lsoundserver_idl $(LIB_KDEUI) $(top_builddir)/arts/kde/libartskde.la $(LIB_QT) $(top_builddir)/dcop/libDCOP.la $(LIB_KDECORE) -lartsflow_idl -lmcop
endif
knotify_la_LDFLAGS = $(all_libraries) -module -avoid-version
knotify_la_METASOURCES = AUTO

+ 4
- 2
configure.in.in View File

@@ -19,6 +19,8 @@ AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(@MODULENAME@, @VERSION@) dnl searches for some needed programs

AM_MAINTAINER_MODE

AC_PROG_INSTALL

dnl generate the config header
@@ -46,7 +48,7 @@ dnl Checks for header files.
KDE_CHECK_STL
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(sys/param.h sys/mman.h sys/time.h sysent.h strings.h sys/stat.h sys/select.h paths.h malloc.h limits.h sys/soundcard.h dlfcn.h termios.h)
AC_CHECK_HEADERS(sys/param.h sys/mman.h sys/time.h sysent.h strings.h sys/stat.h sys/select.h paths.h malloc.h limits.h sys/soundcard.h dlfcn.h termios.h sys/prctl.h)

AC_ARG_WITH(acl,
[AC_HELP_STRING(--with-acl,
@@ -162,7 +164,7 @@ AC_CHECK_RANDOM
AC_CHECK_MKSTEMPS
AC_CHECK_MKSTEMP
AC_CHECK_MKDTEMP
AC_CHECK_FUNCS(strtoll socket seteuid setegid strfmon stpcpy gettimeofday readdir_r setpriority)
AC_CHECK_FUNCS(strtoll socket seteuid setegid strfmon stpcpy gettimeofday readdir_r setpriority tcgetattr tcsetattr)

AH_BOTTOM([
/* provide a definition for a 32 bit entity, usable as a typedef, possibly

+ 1
- 1
dcop/Makefile.am View File

@@ -46,7 +46,7 @@ libDCOP_la_SOURCES = dcopstub.cpp dcopref.cpp dcopobject.cpp dcopclient.cpp
kdeinit_LTLIBRARIES = dcopserver.la
dcopserver_la_LDFLAGS = -module -avoid-version $(all_libraries)
dcopserver_la_SOURCES = dcopserver.cpp dcopsignals.cpp
dcopserver_la_LIBADD = libDCOP.la
dcopserver_la_LIBADD = libDCOP.la $(LIB_QT)

dcopserver_shutdown_SOURCES = dcopserver_shutdown.c


+ 4
- 3
dcop/dcopidlng/dcopidlng View File

@@ -1,15 +1,16 @@
#!/bin/sh

trap "rm -f dcopidlng.stderr.$$" 0 1 2 15
tmpfile=`mktemp -t dcopidlng.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
trap " [ -f \"$tmpfile\" ] && /bin/rm -f -- \"$tmpfile\"" 0 1 2 3 13 15

if test -z "$KDECONFIG"; then
KDECONFIG=kde-config
fi
LIBDIR="`$KDECONFIG --install data --expandvars`/dcopidlng"
perl -I"$LIBDIR" "$LIBDIR/kalyptus" --allow_k_dcop_accessors -f dcopidl $1 2> dcopidlng.stderr.$$
perl -I"$LIBDIR" "$LIBDIR/kalyptus" --allow_k_dcop_accessors -f dcopidl $1 2> $tmpfile
RET=$?
if [ $RET -ne 0 ]
then
cat dcopidlng.stderr.$$ >&2
cat $tmpfile >&2
fi
exit $RET

+ 2
- 2
dnssd/Makefile.am View File

@@ -1,5 +1,5 @@
# set the include path for X, qt and KDE
INCLUDES = -I$(top_srcdir) $(all_includes)
INCLUDES = -I$(top_srcdir) $(all_includes) $(AVAHI_CFLAGS)

# these are the headers for your project
noinst_HEADERS = sdevent.h
@@ -14,7 +14,7 @@ libkdnssd_la_SOURCES = remoteservice.cpp responder.cpp servicebase.cpp \
dnssdincludedir = $(includedir)/dnssd
dnssdinclude_HEADERS = domainbrowser.h query.h remoteservice.h \
publicservice.h servicebase.h servicebrowser.h settings.h
libkdnssd_la_LIBADD = ../kdecore/libkdecore.la $(LIB_DNSSD)
libkdnssd_la_LIBADD = ../kdecore/libkdecore.la $(AVAHI_LIBS) $(LIB_QT)
libkdnssd_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -version-info 1:0

#kde_kcfg_DATA = kcm_kdnssd.kcfg

+ 3
- 4
dnssd/README View File

@@ -1,12 +1,11 @@
Checklist to ensure that zeroconf will work:

1) Install Apple's mdnsd, at least version 85
2) kdelibs (and kdebase for ksysguard) should be configured and compiled with dns_sd sdk (part
of mdnsd installation) present - config.h should contain '#define HAVE_DNSSD 1'
1) Install Avahi, at least version 0.3
2) compile kdnssd-avahi and install it to replace 'stub' libkdnssd.so provided by kdelibs
3) check /etc/nsswitch.conf and ensure that there is 'mdns' before 'dns' in
line starting with 'host:'. It should be something like:
host: files mdns dns
4) ensure that mdnsd is being started in initscripts
4) ensure that avahi-daemon is being started in initscripts
5) for testing: use kpf kicker applet to publish a directory, then open 'zeroconf:/'
URL in konqueror. You should be able to see a local webserver with that published dir.


+ 14
- 35
dnssd/configure.in.in View File

@@ -1,38 +1,17 @@
#MIN_CONFIG

AC_ARG_ENABLE(dnssd, [ --disable-dnssd don't require libdns_sd (browsing and publishing DNS-SD services will not be possible) ], with_dnssd=$enableval, with_dnssd=yes)
if test "$with_dnssd" = "yes"; then
AC_MSG_CHECKING(for DNS-SD support)
save_dnssdtest_LIBS="$LIBS"
save_dnssdtest_LDFLAGS="$LDFLAGS"
save_dnssdtest_CPPFLAGS="$CPPFLAGS"
LDFLAGS="$all_libraries $LDFLAGS"
CPPFLAGS="$CPPFLAGS $all_includes"
case $host_os in
darwin*) LIBS="" ;;
*) LIBS="-ldns_sd" ;;
esac
have_libdns_sd="no"
AC_TRY_LINK( [
#include <dns_sd.h>
],[
DNSServiceRefDeallocate( (DNSServiceRef) 0);
TXTRecordDeallocate( (TXTRecordRef*) 0);
],[
AC_DEFINE(HAVE_DNSSD,1,[Define if dns-sd is available])
case $host_os in
darwin*) LIB_DNSSD="" ;;
*) LIB_DNSSD="-ldns_sd" ;;
esac
have_libdns_sd="yes"
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
LIB_DNSSD=""
])
CPPFLAGS=$save_dnssdtest_CPPFLAGS
LDFLAGS=$save_dnssdtest_LDFLAGS
LIBS=$save_dnssdtest_LIBS
# Check for pkg-config manually first, as if its not installed the
# PKG_PROG_PKG_CONFIG macro won't be defined.
m4_pattern_allow(PKG_CONFIG_MIN_VERSION)
AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)

if test x"$have_pkg_config" == xno; then
AC_MSG_ERROR(pkg-config is required to install this program)
fi
AC_SUBST(LIB_DNSSD)
AM_CONDITIONAL(HAVE_DNSSD, test "$have_libdns_sd" = "yes")

PKG_PROG_PKG_CONFIG

PKG_CHECK_MODULES( AVAHI, [ avahi-qt3 >= 0.4 , avahi-client >= 0.4 ])
AC_SUBST(AVAHI_CFLAGS)
AC_SUBST(AVAHI_LIBS)
PKG_CHECK_EXISTS( [ avahi-client >= 0.6], AC_DEFINE(AVAHI_API_0_6,1,[Avahi API 0.6] ) )

+ 45
- 30
dnssd/domainbrowser.cpp View File

@@ -27,46 +27,56 @@
#include "query.h"
#include "servicebrowser.h"
#include <kapplication.h>
#ifdef AVAHI_API_0_6
#include <avahi-client/lookup.h>
#endif

namespace DNSSD
{

#ifdef HAVE_DNSSD
void domain_callback(DNSServiceRef, DNSServiceFlags flags, uint32_t, DNSServiceErrorType errorCode,
const char *replyDomain, void *context);
#ifdef AVAHI_API_0_6
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
AvahiLookupResultFlags, void* context);
#else
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
void* context);
#endif

class DomainBrowserPrivate : public Responder

class DomainBrowserPrivate
{
public:
DomainBrowserPrivate(DomainBrowser* owner) : Responder(), m_browseLAN(false), m_started(false), m_owner(owner) {}
DomainBrowserPrivate(DomainBrowser* owner) : m_browseLAN(false), m_started(false),
m_browser(0), m_owner(owner) {}
~DomainBrowserPrivate() { if (m_browser) avahi_domain_browser_free(m_browser); }
QStringList m_domains;
virtual void customEvent(QCustomEvent* event);
bool m_browseLAN;
bool m_started;
AvahiDomainBrowser* m_browser;
DomainBrowser* m_owner;
};

void DomainBrowserPrivate::customEvent(QCustomEvent* event)
{
if (event->type()==QEvent::User+SD_ERROR) stop();
if (event->type()==QEvent::User+SD_ADDREMOVE) {
AddRemoveEvent *aev = static_cast<AddRemoveEvent*>(event);
if (aev->m_op==AddRemoveEvent::Add) m_owner->gotNewDomain(aev->m_domain);
else m_owner->gotRemoveDomain(aev->m_domain);
}
}

DomainBrowser::DomainBrowser(QObject *parent) : QObject(parent)
{
d = new DomainBrowserPrivate(this);
d->m_domains = Configuration::domainList();
d->m_domains = Configuration::domainList();
if (Configuration::browseLocal()) {
d->m_domains+="local.";
d->m_browseLAN=true;
}
connect(KApplication::kApplication(),SIGNAL(kipcMessage(int,int)),this,
SLOT(domainListChanged(int,int)));
connect(KApplication::kApplication(),SIGNAL(kipcMessage(int,int)),this,
SLOT(domainListChanged(int,int)));
}

DomainBrowser::DomainBrowser(const QStringList& domains, bool recursive, QObject *parent) : QObject(parent)
@@ -88,14 +98,15 @@ void DomainBrowser::startBrowse()
if (d->m_started) return;
d->m_started=true;
if (ServiceBrowser::isAvailable()!=ServiceBrowser::Working) return;
QStringList::const_iterator itEnd = d->m_domains.end();
QStringList::const_iterator itEnd = d->m_domains.end();
for (QStringList::const_iterator it=d->m_domains.begin(); it!=itEnd; ++it ) emit domainAdded(*it);
#ifdef HAVE_DNSSD
if (d->m_browseLAN) {
DNSServiceRef ref;
if (DNSServiceEnumerateDomains(&ref,kDNSServiceFlagsBrowseDomains,0,domain_callback,
reinterpret_cast<void*>(d))==kDNSServiceErr_NoError) d->setRef(ref);
}
if (d->m_browseLAN)
#ifdef AVAHI_API_0_6
d->m_browser = avahi_domain_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
"local.", AVAHI_DOMAIN_BROWSER_BROWSE, (AvahiLookupFlags)0, domains_callback, this);
#else
d->m_browser = avahi_domain_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
"local.", AVAHI_DOMAIN_BROWSER_BROWSE, domains_callback, this);
#endif
}

@@ -115,9 +126,14 @@ void DomainBrowser::gotRemoveDomain(const QString& domain)
void DomainBrowser::domainListChanged(int message,int)
{
if (message!=KIPCDomainsChanged) return;

bool was_started = d->m_started;
if (d->isRunning()) d->stop(); // LAN query
if (d->m_browser) {
avahi_domain_browser_free(d->m_browser); // LAN query
d->m_browser=0;
}
d->m_started = false;

// remove all domains and resolvers
if (was_started) {
QStringList::const_iterator itEnd = d->m_domains.end();
@@ -129,7 +145,7 @@ void DomainBrowser::domainListChanged(int message,int)
Configuration::self()->readConfig();
d->m_browseLAN = Configuration::browseLocal();
d->m_domains = Configuration::domainList();
if (Configuration::browseLocal()) d->m_domains+="local.";
if (Configuration::browseLocal()) d->m_domains+="local";
// this will emit domainAdded() for every domain if necessary
if (was_started) startBrowse();
}
@@ -147,22 +163,21 @@ bool DomainBrowser::isRunning() const
void DomainBrowser::virtual_hook(int, void*)
{}

#ifdef HAVE_DNSSD
void domain_callback(DNSServiceRef, DNSServiceFlags flags, uint32_t, DNSServiceErrorType errorCode,
const char *replyDomain, void *context)
#ifdef AVAHI_API_0_6
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
AvahiLookupResultFlags,void* context)
#else
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
void* context)
#endif
{
QObject *obj = reinterpret_cast<QObject*>(context);
if (errorCode != kDNSServiceErr_NoError) {
ErrorEvent err;
QApplication::sendEvent(obj, &err);
} else {
AddRemoveEvent arev((flags & kDNSServiceFlagsAdd) ? AddRemoveEvent::Add :
AddRemoveEvent* arev=new AddRemoveEvent((event==AVAHI_BROWSER_NEW) ? AddRemoveEvent::Add :
AddRemoveEvent::Remove, QString::null, QString::null,
DNSToDomain(replyDomain), !(flags & kDNSServiceFlagsMoreComing));
QApplication::sendEvent(obj, &arev);
}
DNSToDomain(replyDomain));
QApplication::postEvent(obj, arev);
}
#endif

}
#include "domainbrowser.moc"

+ 121
- 71
dnssd/publicservice.cpp View File

@@ -30,6 +30,12 @@
#include <network/ksocketaddress.h>
#include <kurl.h>
#include <unistd.h>
#include <avahi-client/client.h>
#ifdef AVAHI_API_0_6
#include <avahi-client/publish.h>
#endif
#include <avahi-common/alternative.h>
#include <avahi-common/strlst.h>
#include "sdevent.h"
#include "responder.h"
#include "servicebrowser.h"
@@ -38,16 +44,23 @@
namespace DNSSD
{
static unsigned long publicIP();
#ifdef HAVE_DNSSD
void publish_callback (DNSServiceRef, DNSServiceFlags, DNSServiceErrorType errorCode, const char *name,
const char*, const char*, void *context);
#endif
class PublicServicePrivate : public Responder

void publish_callback (AvahiEntryGroup*, AvahiEntryGroupState s, void *context);

class PublicServicePrivate
{
public:
PublicServicePrivate() : m_published(false)
PublicServicePrivate() : m_published(false), m_running(false), m_collision(false), m_group(false)
{}
bool m_published;
bool m_running;
bool m_collision;
AvahiEntryGroup* m_group;
void commit()
{
if (!m_collision) avahi_entry_group_commit(m_group);
}
};

PublicService::PublicService(const QString& name, const QString& type, unsigned int port,
@@ -55,6 +68,10 @@ PublicService::PublicService(const QString& name, const QString& type, unsigned
: QObject(), ServiceBase(name, type, QString::null, domain, port)
{
d = new PublicServicePrivate;
if (Responder::self().client()) {
d->m_group = avahi_entry_group_new(Responder::self().client(), publish_callback,this);
connect(&Responder::self(),SIGNAL(stateChanged(AvahiClientState)),this,SLOT(clientState(AvahiClientState)));
}
if (domain.isNull())
if (Configuration::publishType()==Configuration::EnumPublishType::LAN) m_domain="local.";
else m_domain=Configuration::publishDomain();
@@ -63,114 +80,148 @@ PublicService::PublicService(const QString& name, const QString& type, unsigned

PublicService::~PublicService()
{
stop();
if (d->m_group) avahi_entry_group_free(d->m_group);
delete d;
}

void PublicService::tryApply()
{
if (fillEntryGroup()) d->commit();
else {
stop();
emit published(false);
}
}

void PublicService::setServiceName(const QString& serviceName)
{
m_serviceName = serviceName;
if (d->isRunning()) {
stop();
publishAsync();
}
if (d->m_running) {
avahi_entry_group_reset(d->m_group);
tryApply();
}
}

void PublicService::setDomain(const QString& domain)
{
m_domain = domain;
if (d->isRunning()) {
stop();
publishAsync();
}
if (d->m_running) {
avahi_entry_group_reset(d->m_group);
tryApply();
}
}


void PublicService::setType(const QString& type)
{
m_type = type;
if (d->isRunning()) {
stop();
publishAsync();
}
if (d->m_running) {
avahi_entry_group_reset(d->m_group);
tryApply();
}
}

void PublicService::setPort(unsigned short port)
{
m_port = port;
if (d->isRunning()) {
stop();
publishAsync();
}
if (d->m_running) {
avahi_entry_group_reset(d->m_group);
tryApply();
}
}

bool PublicService::isPublished() const
void PublicService::setTextData(const QMap<QString,QString>& textData)
{
return d->m_published;
m_textData = textData;
if (d->m_running) {
avahi_entry_group_reset(d->m_group);
tryApply();
}
}

void PublicService::setTextData(const QMap<QString,QString>& textData)
bool PublicService::isPublished() const
{
m_textData = textData;
if (d->isRunning()) {
stop();
publishAsync();
}
return d->m_published;
}

bool PublicService::publish()
{
publishAsync();
while (d->isRunning() && !d->m_published) d->process();
while (d->m_running && !d->m_published) Responder::self().process();
return d->m_published;
}

void PublicService::stop()
{
d->stop();
d->m_published = false;
if (d->m_group) avahi_entry_group_reset(d->m_group);
d->m_published = false;
}
bool PublicService::fillEntryGroup()
{
AvahiStringList *s=0;
QMap<QString,QString>::ConstIterator itEnd = m_textData.end();
for (QMap<QString,QString>::ConstIterator it = m_textData.begin(); it!=itEnd ; ++it)
s = avahi_string_list_add_pair(s, it.key().utf8(),it.data().utf8());
#ifdef AVAHI_API_0_6
bool res = (!avahi_entry_group_add_service_strlst(d->m_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, (AvahiPublishFlags)0,
m_serviceName.isNull() ? avahi_client_get_host_name(Responder::self().client()) : m_serviceName.utf8().data(),
m_type.ascii(),domainToDNS(m_domain),m_hostName.utf8(),m_port,s));
#else
bool res = (!avahi_entry_group_add_service_strlst(d->m_group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
m_serviceName.isNull() ? avahi_client_get_host_name(Responder::self().client()) : m_serviceName.utf8().data(),
m_type.ascii(),m_domain.utf8(),m_hostName.utf8(),m_port,s));
#endif
avahi_string_list_free(s);
return res;
}

void PublicService::clientState(AvahiClientState s)
{
if (!d->m_running) return;
switch (s) {
#ifdef AVAHI_API_0_6
case AVAHI_CLIENT_FAILURE:
#else
case AVAHI_CLIENT_S_INVALID:
case AVAHI_CLIENT_DISCONNECTED:
#endif
stop();
emit published(false);
break;
case AVAHI_CLIENT_S_REGISTERING:
case AVAHI_CLIENT_S_COLLISION:
avahi_entry_group_reset(d->m_group);
d->m_collision=true;
break;
case AVAHI_CLIENT_S_RUNNING:
if (d->m_collision) {
d->m_collision=false;
tryApply();
}
}
}

void PublicService::publishAsync()
{
if (d->isRunning()) stop();
#ifdef HAVE_DNSSD
if (ServiceBrowser::isAvailable()==ServiceBrowser::Working) {
TXTRecordRef txt;
TXTRecordCreate(&txt,0,0);
QMap<QString,QString>::ConstIterator itEnd = m_textData.end();
for (QMap<QString,QString>::ConstIterator it = m_textData.begin(); it!=itEnd ; ++it) {
QCString value = it.data().utf8();
if (TXTRecordSetValue(&txt,it.key().utf8(),value.length(),value)!=kDNSServiceErr_NoError) {
TXTRecordDeallocate(&txt);
emit published(false);
return;
}
}
DNSServiceRef ref;
if (DNSServiceRegister(&ref,0,0,m_serviceName.utf8(),m_type.ascii(),domainToDNS(m_domain),NULL,
htons(m_port),TXTRecordGetLength(&txt),TXTRecordGetBytesPtr(&txt),publish_callback,
reinterpret_cast<void*>(this)) == kDNSServiceErr_NoError) d->setRef(ref);
TXTRecordDeallocate(&txt);
if (d->m_running) stop();
if (!d->m_group) {
emit published(false);
return;
}
#endif
if (!d->isRunning()) emit published(false);
AvahiClientState s=Responder::self().state();
d->m_running=true;
d->m_collision=true; // make it look like server is getting out of collision to force registering
clientState(s);
}

#ifdef HAVE_DNSSD
void publish_callback (DNSServiceRef, DNSServiceFlags, DNSServiceErrorType errorCode, const char *name,
const char*, const char*, void *context)
void publish_callback (AvahiEntryGroup*, AvahiEntryGroupState s, void *context)
{
QObject *obj = reinterpret_cast<QObject*>(context);
if (errorCode != kDNSServiceErr_NoError) {
ErrorEvent err;
QApplication::sendEvent(obj, &err);
} else {
PublishEvent pev(QString::fromUtf8(name));
QApplication::sendEvent(obj, &pev);
}
if (s!=AVAHI_ENTRY_GROUP_ESTABLISHED && s!=AVAHI_ENTRY_GROUP_COLLISION) return;
PublishEvent* pev=new PublishEvent(s==AVAHI_ENTRY_GROUP_ESTABLISHED);
QApplication::postEvent(obj, pev);
}
#endif

const KURL PublicService::toInvitation(const QString& host)
{
@@ -194,14 +245,13 @@ const KURL PublicService::toInvitation(const QString& host)

void PublicService::customEvent(QCustomEvent* event)
{
if (event->type()==QEvent::User+SD_ERROR) {
stop();
emit published(false);
}
if (event->type()==QEvent::User+SD_PUBLISH) {
if (!static_cast<PublishEvent*>(event)->m_ok) {
setServiceName(QString::fromUtf8(avahi_alternative_service_name(m_serviceName.utf8())));
return;
}
d->m_published=true;
emit published(true);
m_serviceName = static_cast<PublishEvent*>(event)->m_name;
}
}


+ 5
- 0
dnssd/publicservice.h View File

@@ -23,6 +23,7 @@

#include <qobject.h>
#include <dnssd/servicebase.h>
#include <avahi-client/client.h>

class KURL;
namespace DNSSD
@@ -137,6 +138,10 @@ signals:
void published(bool);
private:
PublicServicePrivate *d;
bool fillEntryGroup();
void tryApply();
private slots:
void clientState(AvahiClientState);

protected:
virtual void customEvent(QCustomEvent* event);

+ 89
- 43
dnssd/query.cpp View File

@@ -22,26 +22,46 @@
#include "responder.h"
#include "remoteservice.h"
#include "sdevent.h"
#include <kdebug.h>
#include <qdatetime.h>
#include <qapplication.h>
#include <qtimer.h>

#define TIMEOUT_WAN 2000
#include <avahi-client/client.h>
#ifdef AVAHI_API_0_6
#include <avahi-client/lookup.h>
#endif

#define TIMEOUT_LAN 200

namespace DNSSD
{
#ifdef HAVE_DNSSD
void query_callback (DNSServiceRef, DNSServiceFlags flags, uint32_t, DNSServiceErrorType errorCode,
const char *serviceName, const char *regtype, const char *replyDomain, void *context);
#ifdef AVAHI_API_0_6

void services_callback(AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* name,
const char* regtype, const char* domain, AvahiLookupResultFlags, void* context);
void types_callback(AvahiServiceTypeBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* regtype,
const char* replyDomain, AvahiLookupResultFlags, void* context);
#else
void services_callback(AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* name,
const char* regtype, const char* domain, void* context);
void types_callback(AvahiServiceTypeBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* regtype,
const char* replyDomain, void* context);
void domains_callback(AvahiDomainBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* replyDomain,
void* context);
#endif
class QueryPrivate : public Responder

enum BrowserType { Types, Services };

class QueryPrivate
{
public:
QueryPrivate(const QString& type, const QString& domain) : Responder(), m_finished(false),
m_domain(domain), m_type(type)
{};
QueryPrivate(const QString& type, const QString& domain) : m_finished(false), m_browser(0),
m_running(false), m_domain(domain), m_type(type) {}
bool m_finished;
BrowserType m_browserType;
void* m_browser;
bool m_running;
QString m_domain;
QTimer timeout;
QString m_type;
@@ -56,12 +76,18 @@ Query::Query(const QString& type, const QString& domain)

Query::~Query()
{
if (d->m_browser) {
switch (d->m_browserType) {
case Services: avahi_service_browser_free((AvahiServiceBrowser*)d->m_browser); break;
case Types: avahi_service_type_browser_free((AvahiServiceTypeBrowser*)d->m_browser); break;
}
}
delete d;
}

bool Query::isRunning() const
{
return d->isRunning();
return d->m_running;
}

bool Query::isFinished() const
@@ -76,16 +102,31 @@ const QString& Query::domain() const

void Query::startQuery()
{
if (d->isRunning()) return;
if (d->m_running) return;
d->m_finished = false;
#ifdef HAVE_DNSSD
DNSServiceRef ref;
if (DNSServiceBrowse(&ref,0,0, d->m_type.ascii(),
domainToDNS(d->m_domain),query_callback,reinterpret_cast<void*>(this))
== kDNSServiceErr_NoError) d->setRef(ref);
if (d->m_type=="_services._dns-sd._udp") {
d->m_browserType = Types;
#ifdef AVAHI_API_0_6
d->m_browser = avahi_service_type_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
domainToDNS(d->m_domain), (AvahiLookupFlags)0, types_callback, this);
#else
d->m_browser = avahi_service_type_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
d->m_domain.utf8(), types_callback, this);
#endif
if (!d->isRunning()) emit finished();
else d->timeout.start(domainIsLocal(d->m_domain) ? TIMEOUT_LAN : TIMEOUT_WAN,true);
} else {
d->m_browserType = Services;
#ifdef AVAHI_API_0_6
d->m_browser = avahi_service_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
d->m_type.ascii(),domainToDNS(d->m_domain), (AvahiLookupFlags)0, services_callback,this);
#else
d->m_browser = avahi_service_browser_new(Responder::self().client(), AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
d->m_type.ascii(),d->m_domain.utf8(),services_callback,this);
#endif
}
if (d->m_browser) {
d->m_running=true;
d->timeout.start(TIMEOUT_LAN,true);
} else emit finished();
}
void Query::virtual_hook(int, void*)
{
@@ -93,24 +134,15 @@ void Query::virtual_hook(int, void*)

void Query::customEvent(QCustomEvent* event)
{
if (event->type()==QEvent::User+SD_ERROR) {
d->stop();
d->m_finished=false;
emit finished();
}
if (event->type()==QEvent::User+SD_ADDREMOVE) {
RemoteService* svr;
d->timeout.start(TIMEOUT_LAN,true);
d->m_finished=false;
AddRemoveEvent *aev = static_cast<AddRemoveEvent*>(event);
// m_type has useless trailing dot
QString type=aev->m_type.left(aev->m_type.length()-1);
// label is badly splitted here - _http _tcp.local. . - rely on decode()
if (d->m_type=="_services._dns-sd._udp") svr = new RemoteService(aev->m_name+"."+
type+"."+aev->m_domain);
else svr = new RemoteService(aev->m_name, type, aev->m_domain);
RemoteService* svr = new RemoteService(aev->m_name,
aev->m_type,aev->m_domain);
if (aev->m_op==AddRemoveEvent::Add) emit serviceAdded(svr);
else emit serviceRemoved(svr);
d->m_finished = aev->m_last;
if (d->m_finished) emit finished();
}
}

@@ -119,22 +151,36 @@ void Query::timeout()
d->m_finished=true;
emit finished();
}
#ifdef HAVE_DNSSD
void query_callback (DNSServiceRef, DNSServiceFlags flags, uint32_t, DNSServiceErrorType errorCode,
const char *serviceName, const char *regtype, const char *replyDomain,
void *context)

#ifdef AVAHI_API_0_6
void services_callback (AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event,
const char* serviceName, const char* regtype, const char* replyDomain, AvahiLookupResultFlags, void* context)
#else
void services_callback (AvahiServiceBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event,
const char* serviceName, const char* regtype, const char* replyDomain, void* context)
#endif
{
QObject *obj = reinterpret_cast<QObject*>(context);
if (errorCode != kDNSServiceErr_NoError) {
ErrorEvent err;
QApplication::sendEvent(obj, &err);
} else {
AddRemoveEvent arev((flags & kDNSServiceFlagsAdd) ? AddRemoveEvent::Add :
AddRemoveEvent* arev = new AddRemoveEvent((event==AVAHI_BROWSER_NEW) ? AddRemoveEvent::Add :
AddRemoveEvent::Remove, QString::fromUtf8(serviceName), regtype,
DNSToDomain(replyDomain), !(flags & kDNSServiceFlagsMoreComing));
QApplication::sendEvent(obj, &arev);
}
DNSToDomain(replyDomain));
QApplication::postEvent(obj, arev);
}

#ifdef AVAHI_API_0_6
void types_callback(AvahiServiceTypeBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* regtype,
const char* replyDomain, AvahiLookupResultFlags, void* context)
#else
void types_callback(AvahiServiceTypeBrowser*, AvahiIfIndex, AvahiProtocol, AvahiBrowserEvent event, const char* regtype,
const char* replyDomain, void* context)
#endif
{
QObject *obj = reinterpret_cast<QObject*>(context);
AddRemoveEvent* arev = new AddRemoveEvent((event==AVAHI_BROWSER_NEW) ? AddRemoveEvent::Add :
AddRemoveEvent::Remove, QString::null, regtype,
DNSToDomain(replyDomain));
QApplication::postEvent(obj, arev);
}

}
#include "query.moc"

+ 53
- 52
dnssd/remoteservice.cpp View File

@@ -27,33 +27,39 @@
#include <sys/types.h>
#endif
#include <netinet/in.h>
#include <avahi-client/client.h>
#include <avahi-common/strlst.h>
#ifdef AVAHI_API_0_6
#include <avahi-client/lookup.h>
#endif
#include "remoteservice.h"
#include "responder.h"
#include "sdevent.h"
#include <kdebug.h>

namespace DNSSD
{
#ifdef HAVE_DNSSD
void resolve_callback ( DNSServiceRef,
DNSServiceFlags,
uint32_t,
DNSServiceErrorType errorCode,
const char*,
const char *hosttarget,
uint16_t port,
uint16_t txtLen,
const unsigned char *txtRecord,
void *context
);

#ifdef AVAHI_API_0_6
void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol proto, AvahiResolverEvent e,
const char* name, const char* type, const char* domain, const char* hostname, const AvahiAddress* a,
uint16_t port, AvahiStringList* txt, AvahiLookupResultFlags, void* context);
#else
void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol proto, AvahiResolverEvent e,
const char* name, const char* type, const char* domain, const char* hostname, const AvahiAddress* a,
uint16_t port, AvahiStringList* txt, void* context);
#endif

class RemoteServicePrivate : public Responder
{
public:
RemoteServicePrivate() : Responder(), m_resolved(false)
{};
RemoteServicePrivate() : m_resolved(false), m_running(false), m_resolver(0) {}
bool m_resolved;
bool m_running;
AvahiServiceResolver* m_resolver;
void stop() {
m_running = false;
if (m_resolver) avahi_service_resolver_free(m_resolver);
m_resolver=0;
}
};

RemoteService::RemoteService(const QString& label)
@@ -83,29 +89,33 @@ RemoteService::RemoteService(const KURL& url)

RemoteService::~RemoteService()
{
if (d->m_resolver) avahi_service_resolver_free(d->m_resolver);
delete d;
}

bool RemoteService::resolve()
{
resolveAsync();
while (d->isRunning() && !d->m_resolved) d->process();
while (d->m_running && !d->m_resolved) Responder::self().process();
d->stop();
return d->m_resolved;
}

void RemoteService::resolveAsync()
{
if (d->isRunning()) return;
if (d->m_running) return;
d->m_resolved = false;
kdDebug() << this << ":Starting resolve of : " << m_serviceName << " " << m_type << " " << m_domain << "\n";
#ifdef HAVE_DNSSD
DNSServiceRef ref;
if (DNSServiceResolve(&ref,0,0,m_serviceName.utf8(), m_type.ascii(),
domainToDNS(m_domain),(DNSServiceResolveReply)resolve_callback,reinterpret_cast<void*>(this))
== kDNSServiceErr_NoError) d->setRef(ref);
// FIXME: first protocol should be set?
#ifdef AVAHI_API_0_6
d->m_resolver = avahi_service_resolver_new(Responder::self().client(),AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
m_serviceName.utf8(), m_type.ascii(), domainToDNS(m_domain), AVAHI_PROTO_UNSPEC, AVAHI_LOOKUP_NO_ADDRESS,
resolve_callback, this);
#else
d->m_resolver = avahi_service_resolver_new(Responder::self().client(),AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC,
m_serviceName.utf8(), m_type.ascii(), m_domain.utf8(), AVAHI_PROTO_UNSPEC, resolve_callback, this);
#endif
if (!d->isRunning()) emit resolved(false);
if (d->m_resolver) d->m_running=true;
else emit resolved(false);
}

bool RemoteService::isResolved() const
@@ -154,42 +164,33 @@ QDataStream & operator>> (QDataStream & s, RemoteService & a)
return s;
}


#ifdef HAVE_DNSSD
void resolve_callback ( DNSServiceRef,
DNSServiceFlags,
uint32_t,
DNSServiceErrorType errorCode,
const char*,
const char *hosttarget,
uint16_t port,
uint16_t txtLen,
const unsigned char *txtRecord,
void *context
)
#ifdef AVAHI_API_0_6
void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol, AvahiResolverEvent e,
const char*, const char*, const char*, const char* hostname, const AvahiAddress*,
uint16_t port, AvahiStringList* txt, AvahiLookupResultFlags, void* context)
#else
void resolve_callback(AvahiServiceResolver*, AvahiIfIndex, AvahiProtocol, AvahiResolverEvent e,
const char*, const char*, const char*, const char* hostname, const AvahiAddress*,
uint16_t port, AvahiStringList* txt, void* context)
#endif
{
QObject *obj = reinterpret_cast<QObject*>(context);
if (errorCode != kDNSServiceErr_NoError) {
if (e != AVAHI_RESOLVER_FOUND) {
ErrorEvent err;
QApplication::sendEvent(obj, &err);
return;
}
char key[256];
int index=0;
unsigned char valueLen;
kdDebug() << "Resolve callback\n";
QMap<QString,QString> map;
const void *voidValue = 0;
while (TXTRecordGetItemAtIndex(txtLen,txtRecord,index++,256,key,&valueLen,
&voidValue) == kDNSServiceErr_NoError)
{
if (voidValue) map[QString::fromUtf8(key)]=QString::fromUtf8((const char*)voidValue,valueLen);
else map[QString::fromUtf8(key)]=QString::null;
}
ResolveEvent rev(DNSToDomain(hosttarget),ntohs(port),map);
while (txt) {
char *key, *value;
size_t size;
if (avahi_string_list_get_pair(txt,&key,&value,&size)) break;
map[QString::fromUtf8(key)]=(value) ? QString::fromUtf8(value) : QString::null;
txt = txt->next;
}
ResolveEvent rev(DNSToDomain(hostname),port,map);
QApplication::sendEvent(obj, &rev);
}
#endif


}

+ 33
- 42
dnssd/responder.cpp View File

@@ -20,62 +20,61 @@

#include "responder.h"
#include <qapplication.h>
#include <qeventloop.h>
#include <kstaticdeleter.h>
#include <kidna.h>
#include <kdebug.h>
#include <avahi-qt3/qt-watch.h>

// dns_sd.h API should care about proper encoding of non-latin1 characters
// but for now it does not
#define IDN_BROKEN_IN_MDNSRESPONDER

namespace DNSSD
{

Responder::Responder(DNSServiceRef ref,QObject *parent, const char *name)
: QObject(parent, name), m_ref(0), m_socket(0)
static KStaticDeleter<Responder> responder_sd;
Responder* Responder::m_self = 0;

void client_callback(AvahiClient *, AvahiClientState s, void* u)
{
setRef(ref);
Responder *r = reinterpret_cast<Responder*>(u);
emit (r->stateChanged(s));
}
void Responder::setRef(DNSServiceRef ref)


Responder::Responder()
{
if (m_socket || m_ref) stop();
m_running = false;
m_ref = ref;
if (m_ref == 0 ) return;
#ifdef HAVE_DNSSD
int fd = DNSServiceRefSockFD(ref);
if (fd == -1) return;
m_socket = new QSocketNotifier(fd,QSocketNotifier::Read,this);
connect(m_socket,SIGNAL(activated(int)),this,SLOT(process()));
m_running = true;
int error;
const AvahiPoll* poll = avahi_qt_poll_get();
#ifdef AVAHI_API_0_6
m_client = avahi_client_new(poll, AVAHI_CLIENT_IGNORE_USER_CONFIG,client_callback, this, &error);
#else
m_client = avahi_client_new(poll, client_callback, this, &error);
#endif
if (!m_client) kdWarning() << "Failed to create avahi client" << endl;
}
Responder::~Responder()
{
stop();
if (m_client) avahi_client_free(m_client);
}

void Responder::stop()
Responder& Responder::self()
{
if (m_socket) delete m_socket;
m_socket = 0;
#ifdef HAVE_DNSSD
if (m_ref) DNSServiceRefDeallocate(m_ref);
#endif
m_ref = 0;
m_running = false;
}

if (!m_self) responder_sd.setObject(m_self, new Responder);
return *m_self;
}

void Responder::process()
{
#ifdef HAVE_DNSSD
if ( DNSServiceProcessResult(m_ref) != kDNSServiceErr_NoError) stop();
#endif
qApp->eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
}

bool Responder::isRunning() const
AvahiClientState Responder::state() const
{
return m_running;
#ifdef AVAHI_API_0_6
return (m_client) ? (avahi_client_get_state(m_client)) : AVAHI_CLIENT_FAILURE;
#else
return (m_client) ? (avahi_client_get_state(m_client)) : AVAHI_CLIENT_DISCONNECTED;
#endif
}

bool domainIsLocal(const QString& domain)
@@ -85,22 +84,14 @@ bool domainIsLocal(const QString& domain)

QCString domainToDNS(const QString &domain)
{
#ifdef IDN_BROKEN_IN_MDNSRESPONDER
if (domainIsLocal(domain)) return domain.utf8();
else return KIDNA::toAsciiCString(domain);
#else
return domain.utf8();
#endif
}

QString DNSToDomain(const char* domain)
{
#ifdef IDN_BROKEN_IN_MDNSRESPONDER
if (domainIsLocal(domain)) return QString::fromUtf8(domain);
else return KIDNA::toUnicode(domain);
#else
return QString::fromUtf8(domain);
#endif
}



+ 14
- 20
dnssd/responder.h View File

@@ -25,12 +25,7 @@
#include <qsocketnotifier.h>
#include <qsignal.h>
#include <config.h>
#ifdef HAVE_DNSSD
#include <dns_sd.h>
#else
#define DNSServiceRef void*
#endif

#include <avahi-client/client.h>
namespace DNSSD
{

@@ -38,30 +33,28 @@ namespace DNSSD
This class should not be used directly.
@author Jakub Stachowski
@short Internal class wrapping dns_sd.h interface
@short Internal class wrapping avahi client
*/
class Responder : public QObject
{
Q_OBJECT

public:
Responder(DNSServiceRef ref=0,QObject *parent = 0, const char *name = 0);
Responder();

~Responder();

/**
Returns true if it is possible to use mDNS service publishing and discovery.
It needs mDNSResponder running.
*/
bool isRunning() const;
void setRef(DNSServiceRef ref);
void stop();
public slots:
static Responder& self();
AvahiClientState state() const;
AvahiClient* client() const { return m_client; }
void process();
protected:
DNSServiceRef m_ref;
bool m_running;
QSocketNotifier *m_socket;
signals:
void stateChanged(AvahiClientState);
private:
AvahiClient* m_client;
static Responder* m_self;
friend void client_callback(AvahiClient*, AvahiClientState, void*);

};

/* Utils functions */
@@ -71,6 +64,7 @@ bool domainIsLocal(const QString& domain);
QCString domainToDNS(const QString &domain);
QString DNSToDomain(const char* domain);


}

#endif

+ 4
- 5
dnssd/sdevent.h View File

@@ -41,24 +41,23 @@ class AddRemoveEvent : public QCustomEvent
public:
enum Operation { Add, Remove };
AddRemoveEvent(Operation op,const QString& name,const QString& type,
const QString& domain, bool last) : QCustomEvent(QEvent::User+SD_ADDREMOVE),
m_op(op), m_name(name), m_type(type), m_domain(domain), m_last(last)
const QString& domain) : QCustomEvent(QEvent::User+SD_ADDREMOVE),
m_op(op), m_name(name), m_type(type), m_domain(domain)
{}

const Operation m_op;
const QString m_name;
const QString m_type;
const QString m_domain;
const bool m_last;
};

class PublishEvent : public QCustomEvent
{
public:
PublishEvent(const QString& name) : QCustomEvent(QEvent::User+SD_PUBLISH), m_name(name)
PublishEvent(bool ok) : QCustomEvent(QEvent::User+SD_PUBLISH), m_ok(ok)
{}

const QString m_name;
bool m_ok;
};

class ResolveEvent : public QCustomEvent

+ 1
- 1
dnssd/servicebase.cpp View File

@@ -34,7 +34,7 @@ ServiceBase::~ServiceBase()

QString ServiceBase::encode()
{
return m_serviceName.replace("\\","\\\\").replace(".","\\.") + QString(".") + m_type +
return m_serviceName.replace(".","\\.").replace("\\","\\\\") + QString(".") + m_type +
QString(".") + m_domain;
}


+ 7
- 18
dnssd/servicebrowser.cpp View File

@@ -23,14 +23,11 @@
#include <qstringlist.h>
#include <qfile.h>
#include "domainbrowser.h"
#include "responder.h"
#include "query.h"
#include "servicebrowser.h"
#include <avahi-client/client.h>
#include <config.h>
#ifdef HAVE_DNSSD
#include <dns_sd.h>
#endif

#define MDNSD_PID "/var/run/mdnsd.pid"

namespace DNSSD
{
@@ -85,20 +82,12 @@ ServiceBrowser::ServiceBrowser(const QString& type,const QString& domain,int fla

const ServiceBrowser::State ServiceBrowser::isAvailable()
{
#ifdef HAVE_DNSSD
QFile f(MDNSD_PID);
if (!f.open(IO_ReadOnly)) return Stopped; // no pidfile
QString line;
if (f.readLine(line,16)<1) return Stopped;
unsigned int pid = line.toUInt();
if (pid==0) return Stopped; // not a pid
return (kill(pid,0)==0 || errno==EPERM) ? Working : Stopped;
// signal 0 only checks if process is running, mdnsd is probably owned by 'nobody' so we will
// get EPERM, if mdnsd is not running error will be ESRCH
AvahiClientState s = Responder::self().state();
#ifdef AVAHI_API_0_6
return (s==AVAHI_CLIENT_FAILURE) ? Stopped : Working;
#else
return Unsupported;
#endif
return (s==AVAHI_CLIENT_S_INVALID || s==AVAHI_CLIENT_DISCONNECTED) ? Stopped : Working;
#endif
}
ServiceBrowser::~ ServiceBrowser()
{

+ 1
- 1
interfaces/kimproxy/library/Makefile.am View File

@@ -16,7 +16,7 @@ kimproxyinclude_HEADERS = kimproxy.h kimproxyiface.h

lib_LTLIBRARIES = libkimproxy.la
libkimproxy_la_LDFLAGS = -no-undefined $(all_libraries)
libkimproxy_la_LIBADD = $(LIB_KIO)
libkimproxy_la_LIBADD = $(LIB_KIO) $(LIB_QT) $(LIB_KDECORE) $(top_builddir)/dcop/libDCOP.la $(LIB_KDEUI)
libkimproxy_la_SOURCES = kimproxy.cpp kimiface.stub kimproxyiface.skel

kimiface_DIR = $(top_srcdir)/interfaces/kimproxy/interface

+ 1
- 1
interfaces/kmediaplayer/Makefile.am View File

@@ -9,7 +9,7 @@ lib_LTLIBRARIES = libkmediaplayer.la

libkmediaplayer_la_SOURCES = player.cpp playerdcopobject.skel view.cpp
libkmediaplayer_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
libkmediaplayer_la_LIBADD = $(LIB_KPARTS)
libkmediaplayer_la_LIBADD = $(LIB_KPARTS) $(LIB_QT) $(top_builddir)/dcop/libDCOP.la $(LIB_KDEUI) $(LIB_KDECORE)
libkmediaplayer_la_METASOURCES = AUTO

kmediaplayerinclude_HEADERS = player.h playerdcopobject.h view.h

+ 1
- 1
interfaces/kmediaplayer/kfileaudiopreview/Makefile.am View File

@@ -5,7 +5,7 @@ kde_module_LTLIBRARIES = kfileaudiopreview.la

kfileaudiopreview_la_SOURCES = kfileaudiopreview.cpp
kfileaudiopreview_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module -avoid-version -no-undefined
kfileaudiopreview_la_LIBADD = $(top_builddir)/interfaces/kmediaplayer/libkmediaplayer.la $(top_builddir)/arts/kde/libartskde.la $(LIB_KIO)
kfileaudiopreview_la_LIBADD = $(top_builddir)/interfaces/kmediaplayer/libkmediaplayer.la $(top_builddir)/arts/kde/libartskde.la $(LIB_KIO) $(LIB_QT) $(LIB_KDECORE)

noinst_HEADERS = kfileaudiopreview.h


+ 1
- 1
interfaces/kscript/Makefile.am View File

@@ -10,7 +10,7 @@ lib_LTLIBRARIES = libkscript.la

libkscript_la_SOURCES = scriptmanager.cpp
libkscript_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined
libkscript_la_LIBADD = $(LIB_KIO)
libkscript_la_LIBADD = $(LIB_KIO) $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI)

kscriptinclude_HEADERS = scriptinterface.h scriptclientinterface.h scriptmanager.h
kscriptincludedir = $(includedir)

+ 1
- 1
interfaces/kscript/sample/Makefile.am View File

@@ -4,7 +4,7 @@ kde_module_LTLIBRARIES = libshellscript.la

libshellscript_la_SOURCES = shellscript.cpp
libshellscript_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) -no-undefined -avoid-version
libshellscript_la_LIBADD = ../libkscript.la
libshellscript_la_LIBADD = ../libkscript.la $(LIB_QT) $(LIB_KDECORE) $(top_builddir)/dcop/libDCOP.la


METASOURCES = AUTO

+ 1
- 1
interfaces/ktexteditor/Makefile.am View File

@@ -23,7 +23,7 @@ libktexteditor_la_SOURCES = ktexteditor.cpp \


libktexteditor_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
libktexteditor_la_LIBADD = $(LIB_KPARTS) $(top_builddir)/dcop/libDCOP.la $(top_builddir)/kabc/libkabc.la
libktexteditor_la_LIBADD = $(LIB_KPARTS) $(top_builddir)/dcop/libDCOP.la $(LIB_KABC) $(LIB_KDECORE) $(LIB_QT) $(LIB_KFILE) $(LIB_KDEUI)

ktexteditorinclude_HEADERS = document.h view.h editor.h plugin.h editinterface.h undointerface.h \
selectioninterface.h cursorinterface.h \

+ 2
- 0
interfaces/terminal/kde_terminal_interface.h View File

@@ -163,6 +163,8 @@ public:
start another program instead or close it yourself.
*/
virtual void setAutoDestroy(bool enabled) = 0;

virtual bool setPtyFd(int master_pty) = 0;
};

#endif

+ 1
- 1
kabc/Makefile.am View File

@@ -22,7 +22,7 @@ CLEANFILES = addressee.h addressee.cpp field.cpp
lib_LTLIBRARIES = libkabc.la
libkabc_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -version-info 3:0:2 -no-undefined
libkabc_la_LIBADD = vcard/libvcard.la vcardparser/libvcards.la $(LIB_KIO) \
$(top_builddir)/kresources/libkresources.la
$(top_builddir)/kresources/libkresources.la $(LIB_QT) $(top_builddir)/dcop/libDCOP.la $(LIB_KDEUI) $(LIB_KDECORE)
libkabc_la_COMPILE_FIRST = addressee.h

libkabc_la_SOURCES = \

+ 1
- 1
kabc/formats/Makefile.am View File

@@ -5,7 +5,7 @@ kde_module_LTLIBRARIES = kabcformat_binary.la
kabcformat_binary_la_SOURCES = binaryformat.cpp
kabcformat_binary_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) \
-no-undefined
kabcformat_binary_la_LIBADD = $(top_builddir)/kabc/libkabc.la
kabcformat_binary_la_LIBADD = $(LIB_KABC) $(LIB_QT) $(LIB_KDECORE)
kabcformat_binary_la_COMPILE_FIRST = $(top_builddir)/kabc/addressee.h

# these are the headers for your project

+ 2
- 2
kabc/plugins/dir/Makefile.am View File

@@ -6,13 +6,13 @@ noinst_HEADERS = resourcedirconfig.h
lib_LTLIBRARIES = libkabc_dir.la
libkabc_dir_la_SOURCES = resourcedir.cpp resourcedirconfig.cpp
libkabc_dir_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -version-info 1:0:0 -no-undefined
libkabc_dir_la_LIBADD = $(LIB_KABC)
libkabc_dir_la_LIBADD = $(LIB_KABC) $(LIB_QT) $(top_builddir)/kresources/libkresources.la $(LIB_KDECORE) $(LIB_KFILE) $(LIB_KDEUI)
libkabc_dir_la_COMPILE_FIRST = $(top_builddir)/kabc/addressee.h

kde_module_LTLIBRARIES = kabc_dir.la
kabc_dir_la_SOURCES = resourcedirplugin.cpp
kabc_dir_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) -no-undefined
kabc_dir_la_LIBADD = libkabc_dir.la
kabc_dir_la_LIBADD = libkabc_dir.la $(LIB_QT) $(LIB_KDECORE)

METASOURCES = AUTO


+ 2
- 2
kabc/plugins/file/Makefile.am View File

@@ -6,14 +6,14 @@ noinst_HEADERS = resourcefileconfig.h
lib_LTLIBRARIES = libkabc_file.la
libkabc_file_la_SOURCES = resourcefile.cpp resourcefileconfig.cpp
libkabc_file_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -version-info 1:0:0 -no-undefined
libkabc_file_la_LIBADD = $(LIB_KABC)
libkabc_file_la_LIBADD = $(LIB_KABC) $(LIB_QT) $(top_builddir)/kresources/libkresources.la $(LIB_KFILE) $(LIB_KDECORE) $(LIB_KDEUI)
libkabc_file_la_COMPILE_FIRST = $(top_builddir)/kabc/addressee.h


kde_module_LTLIBRARIES = kabc_file.la
kabc_file_la_SOURCES = resourcefileplugin.cpp
kabc_file_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) -no-undefined
kabc_file_la_LIBADD = libkabc_file.la
kabc_file_la_LIBADD = libkabc_file.la $(LIB_QT) $(LIB_KDECORE)
kabc_file_la_COMPILE_FIRST = $(top_builddir)/kabc/addressee.h

METASOURCES = AUTO

+ 2
- 2
kabc/plugins/ldapkio/Makefile.am View File

@@ -6,13 +6,13 @@ noinst_HEADERS = resourceldapkioconfig.h
lib_LTLIBRARIES = libkabc_ldapkio.la
libkabc_ldapkio_la_SOURCES = resourceldapkio.cpp resourceldapkioconfig.cpp
libkabc_ldapkio_la_LDFLAGS = $(KDE_RPATH) $(all_libraries) -version-info 1:0:0 -no-undefined
libkabc_ldapkio_la_LIBADD = $(top_builddir)/kabc/libkabc.la $(LIB_KIO)
libkabc_ldapkio_la_LIBADD = $(LIB_KABC) $(LIB_KIO) $(LIB_QT) $(top_builddir)/kresources/libkresources.la $(LIB_KDEUI) $(LIB_KDECORE)
libkabc_ldapkio_la_COMPILE_FIRST = $(top_builddir)/kabc/addressee.h

kde_module_LTLIBRARIES = kabc_ldapkio.la
kabc_ldapkio_la_SOURCES = resourceldapkioplugin.cpp
kabc_ldapkio_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
kabc_ldapkio_la_LIBADD = libkabc_ldapkio.la
kabc_ldapkio_la_LIBADD = libkabc_ldapkio.la $(LIB_QT) $(LIB_KDECORE)

METASOURCES = AUTO


+ 1
- 1
kabc/vcard/Makefile.am View File

@@ -8,7 +8,7 @@ lib_LTLIBRARIES = libvcard.la

libvcard_la_SOURCES = vCard-all.cpp
libvcard_la_LDFLAGS = $(all_libraries)
libvcard_la_LIBADD = $(LIB_KDECORE)
libvcard_la_LIBADD = $(LIB_KDECORE) $(LIB_QT)

check_PROGRAMS = testwrite testread


+ 5
- 1
kate/data/Makefile.am View File

@@ -19,7 +19,11 @@ syntaxkate_DATA = language.dtd syntax.template cpp.xml c.xml html.xml kbasic.xml
cg.xml html-php.xml css-php.xml javascript-php.xml ahdl.xml ansic89.xml tibasic.xml \
purebasic.xml mips.xml logtalk.xml txt2tags.xml xslt.xml stata.xml glsl.xml \
lilypond.xml abc.xml asp.xml asm-avr.xml rib.xml cmake.xml octave.xml javadoc.xml cgis.xml \
spice.xml nasm.xml mediawiki.xml apache.xml m3u.xml ini.xml fstab.xml actionscript.xml
spice.xml nasm.xml mediawiki.xml apache.xml m3u.xml ini.xml fstab.xml actionscript.xml \
abap.xml ansys.xml asn1.xml asterisk.xml bmethod.xml ddoc.xml djangotemplate.xml \
doxygenlua.xml dtd.xml email.xml erlang.xml freebasic.xml gap.xml json.xml maxima.xml \
mergetagtext.xml modelica.xml monobasic.xml nemerle.xml noweb.xml objectivecpp.xml opal.xml \
pgn.xml rapidq.xml scala.xml sisu.xml systemc.xml texinfo.xml xorg.xml xul.xml yaml.xml zonnon.xml

partrcdir = $(kde_confdir)
partrc_DATA = katesyntaxhighlightingrc katefiletyperc

+ 1
- 1
kate/interfaces/Makefile.am View File

@@ -3,7 +3,7 @@ METASOURCES = document.moc view.moc
lib_LTLIBRARIES = libkatepartinterfaces.la

libkatepartinterfaces_la_SOURCES = interfaces.cpp katecmd.cpp
libkatepartinterfaces_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la
libkatepartinterfaces_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la $(LIB_QT) $(LIB_KDEUI) $(LIB_KPARTS) $(LIB_KDECORE)
libkatepartinterfaces_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -no-undefined

kateinclude_HEADERS = document.h view.h

+ 1
- 1
kate/part/Makefile.am View File

@@ -16,7 +16,7 @@ libkate_la_SOURCES = katesearch.cpp katebuffer.cpp katecmds.cpp \

libkatepart_la_SOURCES = dummy.cpp

libkatepart_la_LIBADD = libkate.la ../interfaces/libkatepartinterfaces.la $(top_builddir)/kdeprint/libkdeprint.la $(top_builddir)/kutils/libkutils.la $(top_builddir)/kjs/libkjs.la $(LUA_LIBS)
libkatepart_la_LIBADD = libkate.la ../interfaces/libkatepartinterfaces.la $(LIB_KDEPRINT) $(top_builddir)/kutils/libkutils.la $(top_builddir)/kjs/libkjs.la $(LUA_LIBS) $(LIB_QT) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_KPARTS) $(top_builddir)/interfaces/ktexteditor/libktexteditor.la $(LIB_KFILE) $(top_builddir)/dcop/libDCOP.la

libkatepart_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)


+ 22
- 10
kate/part/katesearch.cpp View File

@@ -377,23 +377,35 @@ void KateSearch::replaceOne()
{
QString replaceWith = m_replacement;
if ( s.flags.regExp && s.flags.useBackRefs ) {
// replace each "(?!\)\d+" with the corresponding capture
QRegExp br("\\\\(\\d+)");
// Replace each "\0"..."\9" with the corresponding capture,
// "\n" and "\t" with newline and tab,
// "\\" with "\",
// and remove the "\" for any other sequence.
QRegExp br("\\\\(.)");
int pos = br.search( replaceWith );
int ncaps = m_re.numCaptures();
while ( pos >= 0 ) {
QString sc;
if ( !pos || replaceWith.at( pos-1) != '\\' ) {
int ccap = br.cap(1).toInt();
QString substitute;
QChar argument = br.cap(1).at(0);
if ( argument.isDigit() ) {
// the second character is a digit, this is a backreference
int ccap = argument.digitValue();
if (ccap <= ncaps ) {
sc = m_re.cap( ccap );
replaceWith.replace( pos, br.matchedLength(), sc );
}
else {
substitute = m_re.cap( ccap );
} else {
kdDebug()<<"KateSearch::replaceOne(): you don't have "<<ccap<<" backreferences in regexp '"<<m_re.pattern()<<"'"<<endl;
break;
}
} else if ( argument == 'n' ) {
substitute = '\n';
} else if ( argument == 't' ) {
substitute = '\t';
} else {
// handle a validly escaped backslash, or an invalid escape.
substitute = argument;
}
pos = br.search( replaceWith, pos + (int)sc.length() );
replaceWith.replace( pos, br.matchedLength(), substitute );
pos = br.search( replaceWith, pos + substitute.length() );
}
}


+ 1
- 1
kate/plugins/insertfile/Makefile.am View File

@@ -5,7 +5,7 @@ METASOURCES = AUTO
kde_module_LTLIBRARIES = ktexteditor_insertfile.la

ktexteditor_insertfile_la_SOURCES = insertfileplugin.cpp
ktexteditor_insertfile_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la
ktexteditor_insertfile_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la $(LIB_QT) $(LIB_KDECORE) $(LIB_KFILE) $(LIB_KDEUI)
ktexteditor_insertfile_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
insertfiledatadir = $(kde_datadir)/ktexteditor_insertfile

+ 1
- 1
kate/plugins/isearch/Makefile.am View File

@@ -5,7 +5,7 @@ METASOURCES = AUTO
kde_module_LTLIBRARIES = ktexteditor_isearch.la

ktexteditor_isearch_la_SOURCES = ISearchPlugin.cpp
ktexteditor_isearch_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la
ktexteditor_isearch_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI)
ktexteditor_isearch_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)
isearchdatadir = $(kde_datadir)/ktexteditor_isearch

+ 1
- 1
kate/plugins/kdatatool/Makefile.am View File

@@ -5,7 +5,7 @@ METASOURCES = AUTO
kde_module_LTLIBRARIES = ktexteditor_kdatatool.la

ktexteditor_kdatatool_la_SOURCES = kate_kdatatool.cpp
ktexteditor_kdatatool_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la
ktexteditor_kdatatool_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la $(LIB_QT) $(LIB_KDECORE) $(LIB_KFILE) $(LIB_KDEUI)
ktexteditor_kdatatool_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)

kdatatooldatadir = $(kde_datadir)/ktexteditor_kdatatool

+ 1
- 1
kate/plugins/wordcompletion/Makefile.am View File

@@ -5,7 +5,7 @@ METASOURCES = AUTO
kde_module_LTLIBRARIES = ktexteditor_docwordcompletion.la

ktexteditor_docwordcompletion_la_SOURCES = docwordcompletion.cpp
ktexteditor_docwordcompletion_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la
ktexteditor_docwordcompletion_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI)
ktexteditor_docwordcompletion_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries)

docwordcompletiondatadir = $(kde_datadir)/ktexteditor_docwordcompletion

+ 1
- 1
kcert/Makefile.am View File

@@ -5,7 +5,7 @@ kde_module_LTLIBRARIES = libkcertpart.la
libkcertpart_la_SOURCES = kcertpart.cc

libkcertpart_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries)
libkcertpart_la_LIBADD = $(LIB_KPARTS)
libkcertpart_la_LIBADD = $(LIB_KPARTS) $(LIB_QT) $(LIB_KDEUI) $(LIB_KFILE) $(LIB_KDECORE)
libkcertpart_la_DEPENDENCIES = $(LIB_KPARTS)

libkcertpart_la_METASOURCES = AUTO

+ 1
- 1
kcmshell/Makefile.am View File

@@ -26,7 +26,7 @@ bin_PROGRAMS =
kdeinit_LTLIBRARIES = kcmshell.la

kcmshell_la_SOURCES = main.cpp main.skel
kcmshell_la_LIBADD = ../kutils/libkutils.la
kcmshell_la_LIBADD = ../kutils/libkutils.la $(LIB_QT) $(LIB_KDEUI) $(top_builddir)/dcop/libDCOP.la $(LIB_KDECORE) $(LIB_KFILE)
kcmshell_la_LDFLAGS = $(all_libraries) -module -avoid-version

noinst_HEADERS = main.h

+ 1
- 1
kconf_update/Makefile.am View File

@@ -23,7 +23,7 @@ lib_LTLIBRARIES =
kdeinit_LTLIBRARIES = kconf_update.la

kconf_update_la_SOURCES = kconf_update.cpp
kconf_update_la_LIBADD = $(LIB_KDECORE)
kconf_update_la_LIBADD = $(LIB_KDECORE) $(LIB_QT)
kconf_update_la_LDFLAGS = $(all_libraries) -module -avoid-version

METASOURCES = AUTO

+ 9
- 3
kdecore/Makefile.am View File

@@ -34,7 +34,7 @@ SUBDIRS = malloc network $(SVGICONS) . kconfig_compiler tests
AM_LDFLAGS = $(LDFLAGS_AS_NEEDED) $(LDFLAGS_NEW_DTAGS)

lib_LTLIBRARIES = libkdefakes.la libkdecore.la
lib_LIBRARIES = libkdefakes_nonpic.a
lib_LIBRARIES = libkdefakes_nonpic.a libkdefakes_pic.a

include_HEADERS = kconfig.h kconfigskeleton.h \
kconfigdata.h ksimpleconfig.h kconfigdialogmanager.h \
@@ -75,6 +75,12 @@ vsnprintf_nonpic.c: $(srcdir)/vsnprintf.c
-rm -f vsnprintf_nonpic.c
$(LN_S) $(srcdir)/vsnprintf.c vsnprintf_nonpic.c

libkdefakes_pic.a: libkdefakes.la
-rm -f libkdefakes_pic.a fakes_pic.o vsnprintf_pic.o
cp -f .libs/fakes.o fakes_pic.o; cp -f .libs/vsnprintf.o vsnprintf_pic.o
ar cru libkdefakes_pic.a fakes_pic.o vsnprintf_pic.o
ranlib libkdefakes_pic.a

noinst_HEADERS = kaccelaction.h kaccelbase.h kaccelprivate.h kckey.h \
kcompletion_private.h netwm_p.h \
kglobalaccel_x11.h kglobalaccel_win.h kkeyserver_x11.h kkeyserver.h \
@@ -116,7 +122,8 @@ libkdecore_la_SOURCES = libintl.cpp kapplication.cpp \
kqiodevicegzip_p.cpp ktimezones.cpp

libkdecore_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(X_LDFLAGS) $(USER_LDFLAGS) -version-info 6:0:2 -no-undefined
libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la $(LIB_XEXT) $(LIBRESOLV) $(LIBUTIL) $(LIBART_LIBS) $(LIB_IDN) ../kdefx/libkdefx.la
libkdecore_la_LIBADD = malloc/libklmalloc.la network/libkdecorenetwork.la $(SVGICON_LIB) ../dcop/libDCOP.la ../libltdl/libltdlc.la \
$(LIBART_LIBS) $(LIB_IDN) $(top_builddir)/kdefx/libkdefx.la $(LIB_QT) $(LIBSM) $(LIB_X11) $(LIBZ) $(LIBDL)
libkdecore_la_NMCHECK = $(srcdir)/libkdecore.nmcheck
libkdecore_la_NMCHECKWEAK = $(srcdir)/libkdecore_weak.nmcheck $(srcdir)/libqt-mt_weak.nmcheck \
$(top_srcdir)/dcop/libDCOP_weak.nmcheck $(top_srcdir)/kdecore/standard_weak.nmcheck
@@ -170,7 +177,6 @@ kde_config_LDFLAGS = $(KDE_RPATH) $(KDE_MT_LDFLAGS)
kgrantpty_SOURCES = kgrantpty.c
kgrantpty_CFLAGS= $(KDE_USE_FPIE)
kgrantpty_LDFLAGS = $(KDE_USE_PIE) $(KDE_RPATH) $(all_libraries)
kgrantpty_LDADD = ./libkdefakes.la

# kgrantpty needs to be installed setuid root
install-exec-hook:

+ 3
- 0
kdecore/kaccel.cpp View File

@@ -127,7 +127,10 @@ bool KAccelEventHandler::x11Event( XEvent* pEvent )
return false;

if( pEvent->type == XKeyPress ) {
unsigned int tmp = pEvent->xkey.state;
pEvent->xkey.state &= ~0x2000;
KKeyNative keyNative( pEvent );
pEvent->xkey.state = tmp;
KKey key( keyNative );
key.simplify();
int keyCodeQt = key.keyCodeQt();

+ 51
- 0
kdecore/kconfigbackend.cpp View File

@@ -505,6 +505,8 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1());
bool fileOptionImmutable = false;
bool groupOptionImmutable = false;
bool groupSkip = false;
bool foundGettextDomain = false;
QCString gettextDomain;

int line = 0;
for(; s < eof; s++)
@@ -596,6 +598,7 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1());
if (groupSkip && !bDefault)
goto sktoeol; // Skip entry


bool optionImmutable = groupOptionImmutable;
bool optionDeleted = false;
bool optionExpand = false;
@@ -695,6 +698,11 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1());
QCString val = printableToString(st, s - st);
//qDebug("found key '%s' with value '%s'", key.data(), val.data());

if (QString(key.data()) == "X-Ubuntu-Gettext-Domain") {
gettextDomain = val.data();
foundGettextDomain = true;
}

KEntryKey aEntryKey(aCurrentGroup, decodeKey(key));
aEntryKey.bLocal = (locale != 0);
aEntryKey.bDefault = bDefault;
@@ -718,6 +726,34 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1());
pConfig->putData(aEntryKey, aEntry, false);
}
}
// Look up translations using KLocale
// https://launchpad.net/distros/ubuntu/+spec/langpacks-desktopfiles-kde
// This calls KLocale up to 10 times for each config file (and each KConfig has up to 4 files)
// so I'll see how much of a performance hit it is
// it also only acts on the last group in a file
// Ideas: only translate most important fields, only translate "Desktop Entry" files,
// do translation per KConfig not per single file
if (!pWriteBackMap) {
QFile file("file.txt");
if (foundGettextDomain) {

KLocale locale(gettextDomain);

QString language = locale.language();
translateKey(locale, aCurrentGroup, QCString("Name"));
translateKey(locale, aCurrentGroup, QCString("Comment"));
translateKey(locale, aCurrentGroup, QCString("Language"));
translateKey(locale, aCurrentGroup, QCString("Keywords"));
translateKey(locale, aCurrentGroup, QCString("About"));
translateKey(locale, aCurrentGroup, QCString("Description"));
translateKey(locale, aCurrentGroup, QCString("GenericName"));
translateKey(locale, aCurrentGroup, QCString("Query"));
translateKey(locale, aCurrentGroup, QCString("ExtraNames"));
translateKey(locale, aCurrentGroup, QCString("X-KDE-Submenu"));
}
}


if (fileOptionImmutable)
bFileImmutable = true;

@@ -732,6 +768,21 @@ qWarning("SIGBUS while reading %s", rFile.name().latin1());
#endif
}

void KConfigINIBackEnd::translateKey(KLocale& locale, QCString currentGroup, QCString key) {
KEntryKey entryKey = KEntryKey(currentGroup, key);
KEntry entry = pConfig->lookupData(entryKey);
if (QString(entry.mValue) != "") {
QString orig = key + "=" + entry.mValue;
QString translate = locale.translate(key + "=" + entry.mValue);
if (QString::compare(orig, translate) != 0) {
translate = translate.mid(key.length() + 1);
entry.mValue = translate.utf8();
entryKey.bLocal = true;
entry.bNLS = true;
pConfig->putData(entryKey, entry, false);
}
}
}

void KConfigINIBackEnd::sync(bool bMerge)
{

+ 6
- 0
kdecore/kconfigbackend.h View File

@@ -25,6 +25,7 @@
#include "kconfigdata.h"
#include <kconfigbase.h>
#include <klockfile.h>
#include <klocale.h>
#include "kdelibs_export.h"

class QFile;
@@ -250,6 +251,11 @@ protected:
void parseSingleConfigFile(QFile& rFile, KEntryMap *pWriteBackMap = 0L,
bool bGlobal = false, bool bDefault = false);

// Kubuntu patch, 2006-08-03
// looks up a key in with KLocale
// see https://launchpad.net/distros/ubuntu/+spec/langpacks-desktopfiles-kde
void translateKey(KLocale& locale, QCString currentGroup, QCString key);

/**
* Writes configuration file back.
*

+ 1
- 1
kdecore/kcrash.cpp View File

@@ -441,7 +441,7 @@ static int openSocket()

if (!kde_home || !kde_home[0])
{
kde_home = "~/.kde/";
kde_home = "~/.kde3/";
}

if (kde_home[0] == '~')

+ 2
- 1
kdecore/kdebug.cpp View File

@@ -238,7 +238,8 @@ static void kDebugBackend( unsigned short nLevel, unsigned int nArea, const char
break;
}

short nOutput = kDebug_data->config ? kDebug_data->config->readNumEntry(key, 2) : 2;
// if no output mode is specified default to no debug output
short nOutput = kDebug_data->config ? kDebug_data->config->readNumEntry(key, 4) : 4;

// If the application doesn't have a QApplication object it can't use
// a messagebox.

+ 1
- 1
kdecore/kdebugrc View File

@@ -86,7 +86,7 @@ InfoOutput=4

# KMail
[5006]
InfoOutput=2
InfoOutput=4

# KitchenSync (Syncing Algorithm)
[5250]

+ 2
- 2
kdecore/kdeversion.h View File

@@ -22,10 +22,10 @@

#include "kdelibs_export.h"

#define KDE_VERSION_STRING "3.5.10"
#define KDE_VERSION_STRING "3.5.11 [Trinity]"
#define KDE_VERSION_MAJOR 3
#define KDE_VERSION_MINOR 5
#define KDE_VERSION_RELEASE 10
#define KDE_VERSION_RELEASE 11
#define KDE_MAKE_VERSION( a,b,c ) (((a) << 16) | ((b) << 8) | (c))

#define KDE_VERSION \

+ 36
- 15
kdecore/kglobalsettings.cpp View File

@@ -50,6 +50,10 @@ static QRgb qt_colorref2qrgb(COLORREF col)
#include <stdlib.h>
#include <kprotocolinfo.h>

#include <qtextcodec.h>
#include <qtextstream.h>
#include <qfile.h>

#ifdef Q_WS_X11
#include <X11/Xlib.h>
#endif
@@ -77,6 +81,31 @@ QColor *KGlobalSettings::alternateColor = 0;

KGlobalSettings::KMouseSettings *KGlobalSettings::s_mouseSettings = 0;

// helper function for reading xdg user dirs: it is required in order to take
// care of locale stuff
void readXdgUserDirs(QString *desktop, QString *documents)
{
QFile f( QDir::homeDirPath() + "/.config/user-dirs.dirs" );

if (!f.open(IO_ReadOnly))
return;

// set the codec for the current locale
QTextStream s(&f);
s.setCodec( QTextCodec::codecForLocale() );

QString line = s.readLine();
while (!line.isNull())
{
if (line.startsWith("XDG_DESKTOP_DIR="))
*desktop = line.remove("XDG_DESKTOP_DIR=").remove("\"").replace("$HOME", QDir::homeDirPath());
else if (line.startsWith("XDG_DOCUMENTS_DIR="))
*documents = line.remove("XDG_DOCUMENTS_DIR=").remove("\"").replace("$HOME", QDir::homeDirPath());

line = s.readLine();
}
}

int KGlobalSettings::dndEventDelay()
{
KConfigGroup g( KGlobal::config(), "General" );
@@ -483,13 +512,17 @@ void KGlobalSettings::initStatic() // should be called initPaths(). Don't put an

KConfigGroup g( KGlobal::config(), "Paths" );

// Desktop Path
*s_desktopPath = QDir::homeDirPath() + "/Desktop/";
*s_desktopPath = g.readPathEntry( "Desktop", *s_desktopPath);
// Read desktop and documents path using XDG_USER_DIRS
readXdgUserDirs(s_desktopPath, s_documentPath);
*s_desktopPath = QDir::cleanDirPath( *s_desktopPath );
if ( !s_desktopPath->endsWith("/") )
s_desktopPath->append('/');

*s_documentPath = QDir::cleanDirPath( *s_documentPath );
if ( !s_documentPath->endsWith("/"))
s_documentPath->append('/');

// Trash Path - TODO remove in KDE4 (kio_trash can't use it for interoperability reasons)
*s_trashPath = *s_desktopPath + i18n("Trash") + "/";
*s_trashPath = g.readPathEntry( "Trash" , *s_trashPath);
@@ -510,18 +543,6 @@ void KGlobalSettings::initStatic() // should be called initPaths(). Don't put an
if ( !s_autostartPath->endsWith("/") )
s_autostartPath->append('/');

// Document Path
*s_documentPath = g.readPathEntry( "Documents",
#ifdef Q_WS_WIN
getWin32ShellFoldersPath("Personal")
#else
QDir::homeDirPath()
#endif
);
*s_documentPath = QDir::cleanDirPath( *s_documentPath );
if ( !s_documentPath->endsWith("/"))
s_documentPath->append('/');

// Make sure this app gets the notifications about those paths
if (kapp)
kapp->addKipcEventMask(KIPC::SettingsChanged);

+ 148
- 0
kdecore/kiconeffect.cpp View File

@@ -24,6 +24,9 @@
#include <qwidget.h>
#include <qpainter.h>
#include <qpen.h>
#include <qapplication.h>
#include <qpoint.h>
#include <qrect.h>

#include <kdebug.h>
#include <kglobal.h>
@@ -768,3 +771,148 @@ KIconEffect::visualActivate(QWidget * widget, QRect rect)
}
}

void
KIconEffect::visualActivate(QWidget * widget, QRect rect, QPixmap *pixmap)
{
if (!KGlobalSettings::visualActivate())
return;

// Image too big to display smoothly
if ((rect.width() > 160) || (rect.height() > 160)) {
visualActivate(widget, rect); // call old effect
return;
}

uint actSpeed = KGlobalSettings::visualActivateSpeed();
uint actCount = QMIN(rect.width(), rect.height()) / 4;


// Clip actCount to range 1..10.
if (actCount < 1)
actCount = 1;

else if (actCount > 10)
actCount = 10;

// Clip actSpeed to range 1..100.
if (actSpeed < 1)
actSpeed = 1;

else if (actSpeed > 100)
actSpeed = 100;

// actSpeed needs to be converted to actDelay.
// actDelay is inversely proportional to actSpeed and needs to be
// divided up into actCount portions.
// We also convert the us value to ms.

unsigned int actDelay = (1000 * (100 - actSpeed)) / actCount;

unsigned int deltaX = rect.width() / actCount * 1.5;
unsigned int deltaY = rect.height() / actCount * 1.5;

QPoint c = rect.center();
QRect maxRect(c.x() - (actCount * 2) * deltaX /2,
c.y() - (actCount * 2) * deltaY /2,
actCount * 2 * deltaX,
actCount * 2 * deltaY);

// convert rect to global coordinates if needed
if ((widget->rect().width() <= maxRect.width())
|| (widget->rect().height() <= maxRect.height()))
{
QPoint topLeft(rect.x(), rect.y());
rect.moveLeft(widget->mapToGlobal(topLeft).x());
rect.moveTop(widget->mapToGlobal(topLeft).y());
c = rect.center();
maxRect.setRect(c.x() - (actCount * 2) * deltaX /2,
c.y() - (actCount * 2) * deltaY /2,
actCount * 2 * deltaX,
actCount * 2 * deltaY);
}

QPainter *p;
QImage img = pixmap->convertToImage();
QPixmap pix;
QPixmap composite(maxRect.width(), maxRect.height(), -1, QPixmap::BestOptim);
QPainter cPainter(&composite);
QPoint cComposite = composite.rect().center();

// enable alpha blending
img.setAlphaBuffer(true);
// Ugly hack... Get "Screenshot" to blt into and even do that on the
// root window if the display area of <widget> is too small
if ((widget->rect().width() <= maxRect.width())
|| (widget->rect().height() <= maxRect.height()))
{
p = new QPainter(QApplication::desktop()->screen( -1 ), TRUE);
pix = QPixmap::grabWindow((QApplication::desktop()->screen( -1 ))->winId(),
maxRect.x(),
maxRect.y(),
maxRect.width(),
maxRect.height());
} else
{
// not as ugly as drawing directly to the screen
p = new QPainter(widget);
pix = QPixmap::grabWidget(widget,
maxRect.x(),
maxRect.y(),
maxRect.width(),
maxRect.height());
}
uchar deltaAlpha = 255 / (actCount * 1.2);
// Activate effect like MacOS X