Browse Source

* Large set of SuSE patches to fix bugs and add functionality

* kdemm is included but not used by knotify as it does not work out of the box


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1171141 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 11 years ago
parent
commit
96900dbce3
  1. 2
      Makefile.am.in
  2. 39
      catalog.xml
  3. 5
      dcop/KDE-ICE/Xtranssock.c
  4. 4
      dcop/dcopc.c
  5. 4
      dcop/dcopclient.cpp
  6. 4
      dcop/dcopserver_shutdown.c
  7. 2
      interfaces/kimproxy/library/kimproxy.cpp
  8. 4
      interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp
  9. 6
      kate/part/katehighlight.cpp
  10. 2
      kdecore/eventsrc
  11. 2
      kdecore/fakes.c
  12. 20
      kdecore/kapplication.cpp
  13. 6
      kdecore/kcatalogue.cpp
  14. 18
      kdecore/kconfigbase.cpp
  15. 1
      kdecore/kconfigbase.h
  16. 4
      kdecore/kcrash.cpp
  17. 31
      kdecore/kdesktopfile.cpp
  18. 2
      kdecore/kdesktopfile.h
  19. 9
      kdecore/klocale.cpp
  20. 17
      kdecore/kstandarddirs.cpp
  21. 4
      kdecore/kwinmodule.cpp
  22. 6
      kded/Makefile.am
  23. 28
      kded/khostname.cpp
  24. 54
      kded/kmimelist.cpp
  25. 75
      kdefx/kstyle.cpp
  26. BIN
      kdemm/0.png
  27. 31
      kdemm/DESIGN
  28. 43
      kdemm/Makefile.am
  29. 27
      kdemm/TODO
  30. 78
      kdemm/backend.cpp
  31. 86
      kdemm/backend.h
  32. 69
      kdemm/channel.cpp
  33. 96
      kdemm/channel.h
  34. 296
      kdemm/factory.cpp
  35. 222
      kdemm/factory.h
  36. 41
      kdemm/mixeriface.h
  37. 30
      kdemm/mmbackendinfo.desktop
  38. 53
      kdemm/player.cpp
  39. 259
      kdemm/player.h
  40. 533
      kdemm/reqspec.html
  41. 198
      kdemm/simpleplayer.cpp
  42. 72
      kdemm/simpleplayer.h
  43. 30
      kdemm/test/Makefile.am
  44. 38
      kdemm/test/main.cpp
  45. 299
      kdemm/test/statetest.cpp
  46. 57
      kdemm/test/statetest.h
  47. 194
      kdemm/test/testwidget.cpp
  48. 64
      kdemm/test/testwidget.h
  49. 34
      kdemm/videoplayer.cpp
  50. 54
      kdemm/videoplayer.h
  51. 31
      kdemm/volumecontrold/Makefile.am
  52. 47
      kdemm/volumecontrold/volumecontrold.cpp
  53. 13
      kdemm/volumecontrold/volumecontrold.desktop
  54. 53
      kdemm/volumecontrold/volumecontrold.h
  55. 1
      kdeprint/cups/cupsdconf2/cupsddialog.cpp
  56. 2
      kdeprint/cups/kmcupsmanager.cpp
  57. 10
      kdeprint/kmvirtualmanager.cpp
  58. 3
      kdeprint/kprintpreview.cpp
  59. 26
      kdeprint/management/smbview.cpp
  60. 3
      kdesu/defaults.h
  61. 2
      kdeui/Makefile.am
  62. 11
      kdeui/kaction.cpp
  63. 23
      kdeui/kactionclasses.cpp
  64. 115
      kdeui/kcombobox.cpp
  65. 46
      kdeui/kcombobox.h
  66. 29
      kdeui/kfontcombo.cpp
  67. 121
      kdeui/kjanuswidget.cpp
  68. 9
      kdeui/kjanuswidget.h
  69. 5
      kdeui/kpassdlg.cpp
  70. 2
      kdeui/ksconfig.cpp
  71. 2
      kdeui/ksyntaxhighlighter.cpp
  72. 31
      kdeui/ktip.cpp
  73. 24
      kdeui/qxembed.cpp
  74. 5
      kdeui/qxembed.h
  75. 2
      kdoctools/kio_help.cpp
  76. 22
      khtml/ecma/xmlhttprequest.cpp
  77. 164
      khtml/khtmlview.cpp
  78. 20
      khtml/khtmlview.h
  79. 18
      khtml/rendering/render_form.cpp
  80. 4
      khtml/rendering/render_form.h
  81. 15
      kinit/autostart.cpp
  82. 25
      kinit/lnusertemp.c
  83. 4
      kinit/wrapper.c
  84. 6
      kio/kfile/kfiledialog.cpp
  85. 59
      kio/kfile/kfilesharedlg.cpp
  86. 3
      kio/kfile/kfilesharedlg.h
  87. 13
      kio/kfile/kurlbar.cpp
  88. 3
      kio/kio/kdirwatch.cpp
  89. 74
      kio/kio/kfileshare.cpp
  90. 24
      kio/kio/kfileshare.h
  91. 10
      kio/kio/kmimetype.cpp
  92. 6
      kio/kio/kremoteencoding.cpp
  93. 15
      kio/kio/kservice.cpp
  94. 10
      kio/kio/kservicegroup.cpp
  95. 2
      kio/kio/netaccess.cpp
  96. 22
      kio/kssl/kopenssl.cc
  97. 16
      kio/kssl/kopenssl.h
  98. 2
      kio/kssl/ksmimecrypto.cc
  99. 32
      kio/kssl/ksslcertificate.cc
  100. 38
      kio/misc/kwalletd/kwalletd.cpp
  101. 6
      kio/misc/kwalletd/kwalletd.h
  102. 2
      kioslave/file/Makefile.am
  103. 26
      kioslave/file/file.cc
  104. 23
      kioslave/ftp/ftp.cc
  105. 5
      kioslave/ftp/ftp.h
  106. 2
      kresources/kresources.desktop
  107. 2
      mimetypes/application/ogg.desktop
  108. 2
      mimetypes/application/vnd.oasis.opendocument.formula.desktop
  109. 2
      mimetypes/application/vnd.sun.xml.base.desktop
  110. 1
      mimetypes/application/x-bittorrent.desktop
  111. 2
      mimetypes/application/x-msdos-program.desktop
  112. 2
      mimetypes/application/x-ogg.desktop
  113. 1
      mimetypes/application/x-rpm.desktop
  114. 2
      mimetypes/text/rtf.desktop
  115. BIN
      pics/crystalsvg/cr128-mime-database.png
  116. BIN
      pics/crystalsvg/cr128-mime-drawing.png
  117. BIN
      pics/crystalsvg/cr128-mime-presentation.png
  118. BIN
      pics/crystalsvg/cr128-mime-rtf.png
  119. BIN
      pics/crystalsvg/cr16-mime-database.png
  120. BIN
      pics/crystalsvg/cr16-mime-drawing.png
  121. BIN
      pics/crystalsvg/cr16-mime-presentation.png
  122. BIN
      pics/crystalsvg/cr16-mime-rtf.png
  123. BIN
      pics/crystalsvg/cr22-mime-database.png
  124. BIN
      pics/crystalsvg/cr22-mime-drawing.png
  125. BIN
      pics/crystalsvg/cr22-mime-presentation.png
  126. BIN
      pics/crystalsvg/cr22-mime-rtf.png
  127. BIN
      pics/crystalsvg/cr32-mime-database.png
  128. BIN
      pics/crystalsvg/cr32-mime-drawing.png
  129. BIN
      pics/crystalsvg/cr32-mime-presentation.png
  130. BIN
      pics/crystalsvg/cr32-mime-rtf.png
  131. BIN
      pics/crystalsvg/cr48-mime-database.png
  132. BIN
      pics/crystalsvg/cr48-mime-drawing.png
  133. BIN
      pics/crystalsvg/cr48-mime-presentation.png
  134. BIN
      pics/crystalsvg/cr48-mime-rtf.png
  135. BIN
      pics/crystalsvg/cr64-mime-database.png
  136. BIN
      pics/crystalsvg/cr64-mime-drawing.png
  137. BIN
      pics/crystalsvg/cr64-mime-presentation.png
  138. BIN
      pics/crystalsvg/cr64-mime-rtf.png
  139. BIN
      pics/crystalsvg/crsc-mime-database.svgz
  140. BIN
      pics/crystalsvg/crsc-mime-drawing.svgz
  141. BIN
      pics/crystalsvg/crsc-mime-presentation.svgz
  142. BIN
      pics/crystalsvg/crsc-mime-rtf.svgz

2
Makefile.am.in

@ -18,7 +18,7 @@
# Boston, MA 02110-1301, USA.
COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post
COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post kdemm
COMPILE_BEFORE_doc = kdoctools
COMPILE_AFTER_kparts = kspell2 kmdi kdeprint kinit kate interfaces kcert khtml krandr
COMPILE_AFTER_kdeprint = kate khtml

39
catalog.xml

@ -0,0 +1,39 @@
<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
prefer="public">
<public publicId="-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN"
uri="dtd/kdex.dtd" />
<public publicId="-//KDE//ELEMENTS DocBook XML Hierarchy Redeclarations 2 V1.0//EN"
uri="dtd/rdbhier2.elements" />
<public publicId="-//KDE//ELEMENTS DocBook XML Pool Redeclarations V1.1//EN"
uri="dtd/rdbpool.elements" />
<public publicId="-//KDE//ELEMENTS DocBook XML Modifications (Restrictions) V1.1//EN"
uri="dtd/modifications.elements" />
<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations V1.2//EN"
uri="entities/general.entities" />
<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations (Persons) V1.0//EN"
uri="entities/contributor.entities" />
<public publicId="-//KDE//ENTITIES DocBook XML Localisation Entity Declarations V1.0//EN"
uri="entities/l10n.entities" />
<public publicId="-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN"
uri="obsolete/kdex.dtd" />
<public publicId="-//KDE//ENTITIES DocBook XML General Entity Declarations V1.1//EN"
uri="obsolete/general.entities" />
<public publicId="-//KDE//ELEMENTS DocBook XML Pool Redeclarations V1.0//EN"
uri="obsolete/rdbpool.elements" />
<public publicId="-//KDE//ELEMENTS DocBook XML Modifications V1.0//EN"
uri="obsolete/modifications.elements" />
<public publicId="-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.0//EN"
uri="obsolete/kdex-412-10.dtd" />
<public publicId="-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN"
uri="obsolete/kdex-412-10.dtd" />
</catalog>

5
dcop/KDE-ICE/Xtranssock.c

@ -1444,6 +1444,7 @@ UnixHostReallyLocal (char *host)
{
char hostnamebuf[256];
char* xauthlocalname = getenv("XAUTHLOCALHOSTNAME");
TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
@ -1451,6 +1452,10 @@ UnixHostReallyLocal (char *host)
{
return (1);
}
else if(xauthlocalname && strcmp (xauthlocalname, host) == 0)
{
return (1);
}
else
{
/*

4
dcop/dcopc.c

@ -684,7 +684,9 @@ dcop_connect()
}
hostName[0] = '\0';
if (gethostname(hostName, sizeof(hostName)))
if (getenv("XAUTHLOCALHOSTNAME"))
strlcpy(hostName, getenv("XAUTHLOCALHOSTNAME"),sizeof(hostName)-1);
else if (gethostname(hostName, sizeof(hostName)))
strcpy(hostName, "localhost");
else
hostName[sizeof(hostName)-1] = '\0';

4
dcop/dcopclient.cpp

@ -277,7 +277,9 @@ static TQCString dcopServerFile(const TQCString &hostname, bool old)
{
char hostName[256];
hostName[0] = '\0';
if (gethostname(hostName, sizeof(hostName)))
if (getenv("XAUTHLOCALHOSTNAME"))
fName += getenv("XAUTHLOCALHOSTNAME");
else if (gethostname(hostName, sizeof(hostName)))
{
fName += "localhost";
}

4
dcop/dcopserver_shutdown.c

@ -95,7 +95,9 @@ static void getDCOPFile(char *dcop_file, char *dcop_file_old, int max_length)
strncat(dcop_file, "/.DCOPserver_", n);
n -= strlen("/.DCOPserver_");
if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
if (getenv("XAUTHLOCALHOSTNAME"))
strncat(dcop_file+strlen(dcop_file), getenv("XAUTHLOCALHOSTNAME"), n);
else if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
{
perror("Error. Could not determine hostname: ");
dcop_file[0] = '\0';

2
interfaces/kimproxy/library/kimproxy.cpp

@ -204,7 +204,7 @@ KIMProxy::KIMProxy( DCOPClient* dc ) : DCOPObject( "KIMProxyIface" ), TQObject()
// FIXME: make this work when the sender object id is set to KIMIFace
if ( !connectDCOPSignal( 0, 0, method, method, false ) )
KMessageBox::information( 0, TQString( "Couldn't connect DCOP signal.\nWon't receive any status notifications!" ) );
kdWarning() << "Couldn't connect DCOP signal. Won't receive any status notifications!" << endl;
}
KIMProxy::~KIMProxy( )

4
interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp

@ -13,7 +13,7 @@
#include <kmimetype.h>
#include <kparts/componentfactory.h>
#include <kplayobjectfactory.h>
#include <kdemm/factory.h>
#include <config-kfile.h>
@ -58,7 +58,7 @@ KFileAudioPreview::KFileAudioPreview( TQWidget *parent, const char *name )
{
KGlobal::locale()->insertCatalogue("kfileaudiopreview");
TQStringList formats = KDE::PlayObjectFactory::mimeTypes();
TQStringList formats = KDE::Multimedia::Factory::self()->playableMimeTypes();
// ###
TQStringList::ConstIterator it = formats.begin();
for ( ; it != formats.end(); ++it )

6
kate/part/katehighlight.cpp

@ -3225,7 +3225,7 @@ void KateHlManager::getDefaults(uint schema, KateAttributeList &list)
list.append(charAttribute);
KateAttribute* string = new KateAttribute();
string->setTextColor(TQColor::TQColor("#D00"));
string->setTextColor(TQColor("#D00"));
string->setSelectedTextColor(Qt::red);
list.append(string);
@ -3242,9 +3242,9 @@ void KateHlManager::getDefaults(uint schema, KateAttributeList &list)
KateAttribute* alert = new KateAttribute();
alert->setTextColor(Qt::black);
alert->setSelectedTextColor( TQColor::TQColor("#FCC") );
alert->setSelectedTextColor( TQColor("#FCC") );
alert->setBold(true);
alert->setBGColor( TQColor::TQColor("#FCC") );
alert->setBGColor( TQColor("#FCC") );
list.append(alert);
KateAttribute* functionAttribute = new KateAttribute();

2
kdecore/eventsrc

@ -2572,7 +2572,7 @@ Comment[wa]=On messaedje critike est håyné
Comment[zh_CN]=正在显示关键消息
Comment[zh_HK]=顯示嚴重警告訊息
Comment[zh_TW]=嚴重的警告訊息已顯示
default_sound=KDE_Glass_Break.ogg
default_sound=KDE_Error_1.ogg
default_presentation=65
nopresentation=18
level=4

2
kdecore/fakes.c

@ -323,6 +323,7 @@ KDECORE_EXPORT int revoke(const char *tty)
#endif
#ifndef HAVE_STRLCPY
#include <string.h>
KDECORE_EXPORT unsigned long strlcpy(char* d, const char* s, unsigned long bufsize)
{
unsigned long len, ret = strlen(s);
@ -341,6 +342,7 @@ KDECORE_EXPORT unsigned long strlcpy(char* d, const char* s, unsigned long bufsi
#endif
#ifndef HAVE_STRLCAT
#include <string.h>
KDECORE_EXPORT unsigned long strlcat(char* d, const char* s, unsigned long bufsize)
{
char *cp;

20
kdecore/kapplication.cpp

@ -41,6 +41,7 @@
#include <tqtooltip.h>
#include <tqstylefactory.h>
#include <tqmetaobject.h>
#include <tqimage.h>
#ifndef QT_NO_SQL
#include <tqsqlpropertymap.h>
#endif
@ -87,6 +88,8 @@
#include <sys/stat.h>
#endif
#include <sys/wait.h>
#include <grp.h>
#include <sys/types.h>
#ifndef Q_WS_WIN
#include "kwin.h"
@ -776,10 +779,15 @@ void KApplication::init(bool GUIenabled)
{
d->guiEnabled = GUIenabled;
if ((getuid() != geteuid()) ||
(getgid() != getegid()))
(getgid() != getegid()) )
{
fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
::exit(127);
// man permissions are not exploitable and better than
// world writable directories
struct group *man = getgrnam("man");
if ( !man || man->gr_gid != getegid() ){
fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
::exit(127);
}
}
KProcessController::ref();
@ -2137,6 +2145,12 @@ void KApplication::propagateSettings(SettingsCategory arg)
KConfigBase* config = KGlobal::config();
KConfigGroupSaver saver( config, "KDE" );
#ifdef QT_HAVE_MAX_IMAGE_SIZE
TQSize maxImageSize(4096, 4096);
maxImageSize = config->readSizeEntry("MaxImageSize", &maxImageSize);
TQImage::setMaxImageSize(maxImageSize);
#endif
int num = config->readNumEntry("CursorBlinkRate", TQApplication::cursorFlashTime());
if ((num != 0) && (num < 200))
num = 200;

6
kdecore/kcatalogue.cpp

@ -66,7 +66,11 @@ KCatalogue::KCatalogue(const TQString & name, const TQString & language )
.arg( d->language )
.arg( d->name );
setFileName( locate( "locale", path ) );
TQString fileName = locate( "locale", path );
if (fileName.isEmpty())
fileName = locate( "locale-bundle", path );
setFileName( fileName );
}

18
kdecore/kconfigbase.cpp

@ -131,6 +131,24 @@ bool KConfigBase::hasKey(const char *pKey) const
return !entry.mValue.isNull();
}
bool KConfigBase::hasTranslatedKey(const char* pKey) const
{
KEntryKey aEntryKey(mGroup, 0);
aEntryKey.c_key = pKey;
aEntryKey.bDefault = readDefaults();
if (!locale().isNull()) {
// try the localized key first
aEntryKey.bLocal = true;
KEntry entry = lookupData(aEntryKey);
if (!entry.mValue.isNull())
return true;
aEntryKey.bLocal = false;
}
return false;
}
bool KConfigBase::hasGroup(const TQString &group) const
{
return internalHasGroup( group.utf8());

1
kdecore/kconfigbase.h

@ -1985,6 +1985,7 @@ public:
protected:
TQCString readEntryUtf8( const char *pKey) const;
bool hasTranslatedKey( const char *pKey ) const;
/**
* The currently selected group. */

4
kdecore/kcrash.cpp

@ -466,7 +466,9 @@ static int openSocket()
sock_file[strlen(sock_file)-1] = 0;
strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
if( getenv("XAUTHLOCALHOSTNAME"))
strncat(sock_file, getenv("XAUTHLOCALHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1);
else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
{
perror("Warning: Could not determine hostname: ");
return -1;

31
kdecore/kdesktopfile.cpp

@ -34,6 +34,8 @@
#include "kapplication.h"
#include "kstandarddirs.h"
#include "kmountpoint.h"
#include "kcatalogue.h"
#include "klocale.h"
#include "kdesktopfile.h"
#include "kdesktopfile.moc"
@ -145,6 +147,27 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path)
return false;
}
TQString KDesktopFile::translatedEntry(const char* key) const
{
if (hasTranslatedKey(key))
return readEntry(key);
if (hasKey(key)) {
TQString value = readEntryUntranslated(key);
TQString fName = fileName();
fName = fName.mid(fName.findRev('/')+1);
TQString po_lookup_key = TQString::fromLatin1(key) + "(" + fName + "): " + value;
TQString po_value = KGlobal::locale()->translate(po_lookup_key.utf8().data());
if (po_value == po_lookup_key)
return value;
return po_value;
}
return TQString::null;
}
TQString KDesktopFile::readType() const
{
return readEntry("Type");
@ -157,17 +180,17 @@ TQString KDesktopFile::readIcon() const
TQString KDesktopFile::readName() const
{
return readEntry("Name");
return translatedEntry("Name");
}
TQString KDesktopFile::readComment() const
{
return readEntry("Comment");
return translatedEntry("Comment");
}
TQString KDesktopFile::readGenericName() const
{
return readEntry("GenericName");
return translatedEntry("GenericName");
}
TQString KDesktopFile::readPath() const
@ -342,5 +365,3 @@ KDesktopFile* KDesktopFile::copyTo(const TQString &file) const
config->setDesktopGroup();
return config;
}

2
kdecore/kdesktopfile.h

@ -236,6 +236,8 @@ private:
private:
TQString translatedEntry(const char*) const;
// copy-construction and assignment are not allowed
KDesktopFile( const KDesktopFile& );
KDesktopFile& operator= ( const KDesktopFile& );

9
kdecore/klocale.cpp

@ -408,7 +408,11 @@ TQString KLocale::catalogueFileName(const TQString & language,
.arg( language )
.arg( catalog.name() );
return locate( "locale", path );
TQString fileName = locate( "locale", path );
if (fileName.isEmpty())
fileName = locate( "locale-bundle", path );
return fileName;
}
bool KLocale::setLanguage(const TQString & language)
@ -507,6 +511,9 @@ bool KLocale::isApplicationTranslatedInto( const TQString & language)
// kdDebug() << "isApplicationTranslatedInto: filename " << sFileName << endl;
TQString sAbsFileName = locate( "locale", sFileName );
if (sAbsFileName.isEmpty())
sAbsFileName = locate( "locale-bundle", sFileName );
// kdDebug() << "isApplicationTranslatedInto: absname " << sAbsFileName << endl;
return ! sAbsFileName.isEmpty();
}

17
kdecore/kstandarddirs.cpp

@ -94,13 +94,13 @@ KStandardDirsSingleton* KStandardDirsSingleton::self() {
return s_self;
}
static const char* const types[] = {"html", "icon", "apps", "sound",
"data", "locale", "services", "mime",
static const char* const types[] = {"html", "html-bundle", "icon", "apps", "sound",
"data", "locale", "locale-bundle", "services", "mime",
"servicetypes", "config", "exe",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu",
"xdgdata-icon", "xdgdata-pixmap",
"xdgdata-icon", "xdgdata-pixmap", "xdgconf-autostart",
"kcfg", "emoticons", 0 };
static int tokenize( TQStringList& token, const TQString& str,
@ -719,7 +719,10 @@ void KStandardDirs::createSpecialResource(const char *type)
{
char hostname[256];
hostname[0] = 0;
gethostname(hostname, 255);
if( getenv("XAUTHLOCALHOSTNAME"))
strlcpy(hostname, getenv("XAUTHLOCALHOSTNAME"), 255 );
else
gethostname(hostname, 255);
TQString dir = TQString("%1%2-%3").arg(localkdedir()).arg(type).arg(hostname);
char link[1024];
link[1023] = 0;
@ -1024,6 +1027,8 @@ static int tokenize( TQStringList& tokens, const TQString& str,
TQString KStandardDirs::kde_default(const char *type) {
if (!strcmp(type, "data"))
return "share/apps/";
if (!strcmp(type, "html-bundle"))
return "share/doc-bundle/HTML/";
if (!strcmp(type, "html"))
return "share/doc/kde/HTML/";
if (!strcmp(type, "icon"))
@ -1036,6 +1041,8 @@ TQString KStandardDirs::kde_default(const char *type) {
return "share/applnk/";
if (!strcmp(type, "sound"))
return "share/sounds/";
if (!strcmp(type, "locale-bundle"))
return "share/locale-bundle/";
if (!strcmp(type, "locale"))
return "share/locale/";
if (!strcmp(type, "services"))
@ -1068,6 +1075,8 @@ TQString KStandardDirs::kde_default(const char *type) {
return "desktop-directories/";
if (!strcmp(type, "xdgconf-menu"))
return "menus/";
if (!strcmp(type, "xdgconf-autostart"))
return "autostart/";
if (!strcmp(type, "kcfg"))
return "share/config.kcfg";
if (!strcmp(type, "emoticons"))

4
kdecore/kwinmodule.cpp

@ -436,7 +436,9 @@ TQRect KWinModule::workArea( const TQValueList<WId>& exclude, int desktop ) cons
if ( strut.bottom > 0 )
r.setBottom( r.bottom() - (int) strut.bottom );
a = a.intersect(r);
TQRect tmp;
tmp = a.intersect(r);
a = tmp;
}
return a;
}

6
kded/Makefile.am

@ -36,12 +36,16 @@ kbuildsycoca_la_SOURCES = kbuildsycoca.cpp kbuildservicetypefactory.cpp \
kctimefactory.cpp \
vfolder_menu.cpp
bin_PROGRAMS = kdontchangethehostname kde-menu
bin_PROGRAMS = kdontchangethehostname kde-menu kmimelist
kdontchangethehostname_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kdontchangethehostname_LDADD = $(LIB_KDECORE)
kdontchangethehostname_SOURCES = khostname.cpp
kmimelist_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kmimelist_LDADD = ../kio/libkio.la
kmimelist_SOURCES = kmimelist.cpp
kde_menu_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kde_menu_LDADD = $(LIB_KIO)
kde_menu_SOURCES = kde-menu.cpp

28
kded/khostname.cpp

@ -111,7 +111,8 @@ static QCStringList split(const TQCString &str)
void KHostName::changeX()
{
TQString cmd = "xauth list";
const char* xauthlocalhostname = getenv("XAUTHLOCALHOSTNAME");
TQString cmd = "xauth -n list";
FILE *xFile = popen(TQFile::encodeName(cmd), "r");
if (!xFile)
{
@ -123,6 +124,7 @@ void KHostName::changeX()
char buf[1024+1];
while (!feof(xFile))
{
buf[1024]='\0';
TQCString line = fgets(buf, 1024, xFile);
if (line.length())
line.truncate(line.length()-1); // Strip LF.
@ -157,12 +159,17 @@ void KHostName::changeX()
TQCString newNetId = newName+netId.mid(i);
TQCString oldNetId = netId.left(i);
if(oldNetId != oldName)
continue;
if(oldNetId != oldName
&& (!xauthlocalhostname || strcmp(xauthlocalhostname, oldNetId.data()) != 0))
continue;
cmd = "xauth remove "+KProcess::quote(netId);
system(TQFile::encodeName(cmd));
cmd = "xauth add ";
// don't nuke the xauth when XAUTHLOCALHOSTNAME points to it
if (!xauthlocalhostname || oldNetId != xauthlocalhostname)
{
cmd = "xauth -n remove "+KProcess::quote(netId);
system(TQFile::encodeName(cmd));
}
cmd = "xauth -n add ";
cmd += KProcess::quote(newNetId);
cmd += " ";
cmd += KProcess::quote(authName);
@ -276,7 +283,10 @@ void KHostName::changeDcop()
}
}
// Remove old entries
// Remove old entries, but only if XAUTHLOCALHOSTNAME doesn't point
// to it
char* xauthlocalhostname = getenv("XAUTHLOCALHOSTNAME");
if (!xauthlocalhostname || !oldNetId.contains(xauthlocalhostname))
{
TQString cmd = "iceauth remove "+KProcess::quote("netid="+oldNetId);
system(TQFile::encodeName(cmd));
@ -368,9 +378,7 @@ int main(int argc, char **argv)
KHostName hn;
if(!getenv("XAUTHLOCALHOSTNAME"))
hn.changeX();
hn.changeX();
hn.changeDcop();
hn.changeStdDirs("socket");
hn.changeStdDirs("tmp");

54
kded/kmimelist.cpp

@ -0,0 +1,54 @@
#include <ktrader.h>
#include <kservice.h>
#include <kmimetype.h>
#include <assert.h>
#include <kstandarddirs.h>
#include <kservicegroup.h>
#include <kimageio.h>
#include <kuserprofile.h>
#include <kprotocolinfo.h>
#include <kapplication.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
KApplication k(argc,argv,"blurb",false);
KMimeType::List mtl = KMimeType::allMimeTypes( );
assert( mtl.count() );
qDebug( "Found %d mime types.", mtl.count() );
TQValueListIterator<KMimeType::Ptr> it(mtl.begin());
KServiceTypeProfile::OfferList ol;
for (; it != mtl.end(); ++it)
{
{
// Application
printf( "APP:%s:", (*it)->name().latin1() );
ol = KServiceTypeProfile::offers((*it)->name(), "Application");
TQValueListIterator<KServiceOffer> it2(ol.begin());
for (; it2 != ol.end(); ++it2) {
if ((*it2).allowAsDefault())
printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
}
printf( "\n" );
}
{
// Embedded
printf( "PART:%s:", (*it)->name().latin1() );
ol = KServiceTypeProfile::offers((*it)->name(), "KParts/ReadOnlyPart");
TQValueListIterator<KServiceOffer> it2(ol.begin());
for (; it2 != ol.end(); ++it2) {
if ((*it2).allowAsDefault())
printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
}
printf( "\n" );
}
}
}

75
kdefx/kstyle.cpp

@ -31,6 +31,7 @@
#include <tqapplication.h>
#include <tqbitmap.h>
#include <tqmetaobject.h>
#include <tqcleanuphandler.h>
#include <tqmap.h>
#include <tqimage.h>
@ -79,7 +80,7 @@ namespace
TQWidget* w1;
TQWidget* w2;
};
typedef TQMap<const TQPopupMenu*,ShadowElements> ShadowMap;
typedef TQMap<const TQWidget*,ShadowElements> ShadowMap;
static ShadowMap *_shadowMap = 0;
TQSingleCleanupHandler<ShadowMap> cleanupShadowMap;
ShadowMap &shadowMap() {
@ -113,8 +114,13 @@ namespace
const double shadow_strip[4] =
{ 0.565, 0.675, 0.835, 0.945 };
}
static bool useDropShadow(TQWidget* w)
{
return w && w->metaObject() &&
w->metaObject()->findProperty("KStyleMenuDropShadow") != -1;
}
}
namespace
{
@ -128,12 +134,12 @@ class TransparencyHandler : public QObject
protected:
void blendToColor(const TQColor &col);
void blendToPixmap(const TQColorGroup &cg, const TQPopupMenu* p);
void blendToPixmap(const TQColorGroup &cg, const TQWidget* p);
#ifdef HAVE_XRENDER
void XRenderBlendToPixmap(const TQPopupMenu* p);
void XRenderBlendToPixmap(const TQWidget* p);
#endif
void createShadowWindows(const TQPopupMenu* p);
void removeShadowWindows(const TQPopupMenu* p);
void createShadowWindows(const TQWidget* p);
void removeShadowWindows(const TQWidget* p);
void rightShadow(TQImage& dst);
void bottomShadow(TQImage& dst);
private:
@ -256,8 +262,16 @@ void KStyle::polish( TQWidget* widget )
widget->installEventFilter(this);
}
}
}
if (widget->isTopLevel())
{
if (!d->menuHandler && useDropShadow(widget))
d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, false);
if (d->menuHandler && useDropShadow(widget))
widget->installEventFilter(d->menuHandler);
}
}
void KStyle::unPolish( TQWidget* widget )
{
@ -267,8 +281,10 @@ void KStyle::unPolish( TQWidget* widget )
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
widget->removeEventFilter(this);
}
}
}
if (widget->isTopLevel() && d->menuHandler && useDropShadow(widget))
widget->removeEventFilter(d->menuHandler);
}
@ -2016,7 +2032,7 @@ void TransparencyHandler::bottomShadow(TQImage& dst)
}
// Create a shadow of thickness 4.
void TransparencyHandler::createShadowWindows(const TQPopupMenu* p)
void TransparencyHandler::createShadowWindows(const TQWidget* p)
{
#ifdef Q_WS_X11
int x2 = p->x()+p->width();
@ -2063,7 +2079,7 @@ void TransparencyHandler::createShadowWindows(const TQPopupMenu* p)
#endif
}
void TransparencyHandler::removeShadowWindows(const TQPopupMenu* p)
void TransparencyHandler::removeShadowWindows(const TQWidget* p)
{
#ifdef Q_WS_X11
ShadowMap::iterator it = shadowMap().find(p);
@ -2089,7 +2105,7 @@ bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event )
// Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
// Added 'fake' menu shadows <04-Jul-2002> -- Karol
TQPopupMenu* p = (TQPopupMenu*)object;
TQWidget* p = (TQWidget*)object;
TQEvent::Type et = event->type();
if (et == TQEvent::Show)
@ -2128,13 +2144,23 @@ bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event )
// * shadows after duplicate show events.
// * TODO : determine real cause for duplicate events
// * till 20021005
if (dropShadow && p->width() > 16 && p->height() > 16 && !shadowMap().contains( p ))
if ((dropShadow || useDropShadow(p))
&& p->width() > 16 && p->height() > 16 && !shadowMap().contains( p ))
createShadowWindows(p);
}
else if (et == TQEvent::Resize && p->isShown() && p->isTopLevel())
{
// Handle drop shadow
if (dropShadow || useDropShadow(p))
{
removeShadowWindows(p);
createShadowWindows(p);
}
}
else if (et == TQEvent::Hide)
{
// Handle drop shadow
if (dropShadow)
if (dropShadow || useDropShadow(p))
removeShadowWindows(p);
// Handle translucency
@ -2159,7 +2185,7 @@ void TransparencyHandler::blendToColor(const TQColor &col)
}
void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQPopupMenu* p)
void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQWidget* p)
{
if (opacity < 0.0 || opacity > 1.0)
return;
@ -2172,7 +2198,10 @@ void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQPopupMen
return;
// Allow styles to define the blend pixmap - allows for some interesting effects.
kstyle->renderMenuBlendPixmap( blendPix, cg, p );
if (::qt_cast<TQPopupMenu*>(p))
kstyle->renderMenuBlendPixmap( blendPix, cg, ::qt_cast<TQPopupMenu*>(p) );
else
blendPix.fill(cg.button()); // Just tint as the default behavior
TQImage blendImg = blendPix.convertToImage();
TQImage backImg = pix.convertToImage();
@ -2185,13 +2214,17 @@ void TransparencyHandler::blendToPixmap(const TQColorGroup &cg, const TQPopupMen
// Here we go, use XRender in all its glory.
// NOTE: This is actually a bit slower than the above routines
// on non-accelerated displays. -- Karol.
void TransparencyHandler::XRenderBlendToPixmap(const TQPopupMenu* p)
void TransparencyHandler::XRenderBlendToPixmap(const TQWidget* p)
{
KPixmap renderPix;
renderPix.resize( pix.width(), pix.height() );
// Allow styles to define the blend pixmap - allows for some interesting effects.
kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(), p );
if (::qt_cast<TQPopupMenu*>(p))
kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(),
::qt_cast<TQPopupMenu*>(p) );
else
renderPix.fill(p->colorGroup().button()); // Just tint as the default behavior
Display* dpy = qt_xdisplay();
Pixmap alphaPixmap;
@ -2229,6 +2262,14 @@ void TransparencyHandler::XRenderBlendToPixmap(const TQPopupMenu* p)
void KStyle::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
// HACK for gtk-qt-engine
KDE_EXPORT extern "C"
void kde_kstyle_set_scrollbar_type_windows( void* style )
{
((KStyle*)style)->setScrollBarType( KStyle::WindowsStyleScrollBar );
}
// vim: set noet ts=4 sw=4:
// kate: indent-width 4; replace-tabs off; tab-width 4; space-indent off;

BIN
kdemm/0.png

After

Width: 691  |  Height: 390  |  Size: 21 KiB

31
kdemm/DESIGN

@ -0,0 +1,31 @@
There should be at least two libs:
1. kdemm(core)
==============
Provides the wrapper for the media framework and all needed media functionality.
Whether this lib needs to depend on kdeui? Depends on how we could handle video
without UI... but if possible we should put the video-widget in kdemmwidgets.
The Requirements & Specification document can be found in reqspec.html
2. kdemmwidgets
===============
Provides convenience widgets for the common widgets that are needed:
- Position slider (display position and move it to seek)
- Volume fader
- Effects dialog (including EQ)
- Video widget
- Player controls as toolbar
Also there could be a KPart:
3. kdemmpart
============
A KPart implementing the KMediaPlayer interface.
// vim: tw=80

43
kdemm/Makefile.am

@ -0,0 +1,43 @@
# This file is part of the KDE libraries
# Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License version 2 as published by the Free Software Foundation.
# 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., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
INCLUDES = -I$(top_srcdir)/kdecore -I$(top_srcdir)/kio $(all_includes)
SUBDIRS = . test
lib_LTLIBRARIES = libkdemm.la
kdemmincludedir = $(includedir)/kdemm
kdemminclude_HEADERS = backend.h factory.h player.h channel.h videoplayer.h mixeriface.h simpleplayer.h
libkdemm_la_SOURCES = backend.cpp factory.cpp player.cpp channel.cpp videoplayer.cpp mixeriface.skel simpleplayer.cpp factory.skel
libkdemm_la_LDFLAGS = $(QT_LDFLAGS) $(KDE_RPATH) $(KDE_MT_LDFLAGS) $(USER_LDFLAGS) -version-info 0:0:0 -no-undefined
libkdemm_la_LIBADD = ../kdecore/libkdecore.la ../kio/libkio.la
factory_DCOPIDLNG = true
METASOURCES = AUTO
kde_servicetypes_DATA = mmbackendinfo.desktop
SRCDOC_DEST=$(kde_htmldir)/en/kdelibs/kdemm
DOXYGEN_REFERENCES = dcop kdecore kio
include ../admin/Doxyfile.am

27
kdemm/TODO

@ -0,0 +1,27 @@
Factory
- get a list of available backends
- be able to choose the one you want to use, overriding the KTrader information
- test on the fly switching
Audio
- function to retrieve the PCM data that currently is played (could be done in
the Channel as well as in the Player)
Video
- either a new interface or somehow integrate into the player
If it's a new interface we have to copy most of the Player class, which I
wouldn't like to see.
two wrapper APIs:
- for notifications
play file and don't care
automatically use the notification channel if present
- for simple players
open file and provide seek and volume
Mixer abstraction
- provide access to the hardware mixer and/or the mixer of the backend
- provide access to software volume controls (like the Channels)
Record Interface
- simple PCM recording API

78
kdemm/backend.cpp

@ -0,0 +1,78 @@
/* This file is part of the KDE project
Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "backend.h"
#include "player.h"
#include <tqstringlist.h>
#include <kglobal.h>
#include <kinstance.h>
#include <kaboutdata.h>
namespace KDE
{
namespace Multimedia
{
class Backend::Private
{
public:
Channel * channel;
};
Backend::Backend( TQObject * parent, const char * name )
: TQObject( parent, name )
, d( 0 )
{
}
Backend::~Backend()
{
delete d;
}
bool Backend::playSoundEvent( const KURL & url )
{
if( ! d )
{
d = new Private;
TQString ctype = "notifications";
if( availableChannels( Channel::Output ).contains( ctype ) < 1 )
ctype = "default";
d->channel = createChannel( KGlobal::instance()->aboutData()->programName(), ctype, Channel::Output );
}
Player * player = createPlayer();
player->setOutputChannel( d->channel );
connect( player, TQT_SIGNAL( finished() ), player, TQT_SLOT( deleteLater() ) );
if( player->load( url ) )
if( player->play() )
return true;
delete player;
return false;
}
}} // namespaces
#include "backend.moc"
// vim: sw=4 ts=4 noet

86
kdemm/backend.h

@ -0,0 +1,86 @@
/* This file is part of the KDE project
Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef BACKEND_H
#define BACKEND_H
#include <tqobject.h>
#include <kdemacros.h>
#include <kdemm/channel.h>
#include <kurl.h>
namespace KDE
{
namespace Multimedia
{
class Player;
class VideoPlayer;
/**
* \brief Base class for all KDE Multimedia Backends
*
* This class provides the interface for Multimedia Backends. Use it to get
* a pointer to a new Player or VideoWidget. There are some reserved
* functions for later extension of the class.
*
* \author Matthias Kretz <kretz@kde.org>
* \since 4.0
*/
class Backend : public QObject
{
Q_OBJECT
public:
/**
* default TQObject constructor
*/
Backend( TQObject * parent = 0, const char * name = 0 );
virtual ~Backend();
/**
* @return A new instance to a Player from the Backend.
*/
virtual Player * createPlayer() = 0;
/**
* Create a new VideoPlayer object. The Backend does not have to
* implement this function.
*
* @return A new instance to a VideoPlayer from the Backend. Or 0 if
* the Backend does not support the VideoPlayer interface.
*/
virtual VideoPlayer * createVideoPlayer() { return 0; }
virtual bool playSoundEvent(const KURL & url);
virtual Channel * createChannel( const TQString & title, const TQString & channeltype,
Channel::Direction direction ) = 0;
virtual TQStringList availableChannels( Channel::Direction direction ) const = 0;
virtual TQStringList playableMimeTypes() const = 0;
private:
RESERVE_VIRTUAL_10
class Private;
Private * d;
};
}} // namespaces
// vim: sw=4 ts=4 noet tw=80
#endif // BACKEND_H

69
kdemm/channel.cpp

@ -0,0 +1,69 @@
/* This file is part of the KDE project
Copyright (C) 2004 Scott Wheeler <wheeler@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "channel.h"
#include <tqstring.h>
namespace KDE
{
namespace Multimedia
{
class Channel::Private
{
public:
TQString channelName;
TQString channelType;
Direction direction;
};
Channel::Channel( const TQString & channelName, const TQString & type, Direction direction,
TQObject * parent, const char * name )
: TQObject( parent, name )
{
d = new Private;
d->channelName = channelName;
d->channelType = type;
d->direction = direction;
}
Channel::~Channel()
{
delete d;
}
TQString Channel::channelName() const
{
return d->channelName;
}
TQString Channel::channelType() const
{
return d->channelType;
}
Channel::Direction Channel::direction() const
{
return d->direction;
}
}}
#include "channel.moc"
// vim: sw=4 ts=4 noet

96
kdemm/channel.h

@ -0,0 +1,96 @@
/* This file is part of the KDE project
Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KDEMM_CHANNEL_H
#define KDEMM_CHANNEL_H
#include <kdemm/mixeriface.h>
class TQString;
namespace KDE
{
namespace Multimedia
{
/**
* \short Abstraction of different inputs or outputs
*
* \author Matthias Kretz <kretz@kde.org>
* \since 4.0
*/
class KDE_EXPORT Channel : public TQObject, virtual public MixerIface
{
Q_OBJECT
public:
virtual ~Channel();
enum Direction
{
Input,
Output
};
/**
* The user visible name of the channel
*/
virtual TQString channelName() const;
/**
* The (internal) channel type.
*/
virtual TQString channelType() const;
/**
* Whether it is an Input or Output channel
*/
virtual Direction direction() const;
/**
* If the channel has a volume control this function returns \p true
*/
virtual bool hasVolumeControl() const = 0;
/**
* The current volume of the channel
*/
virtual float volume() const = 0;
/**
* Set the volume for the channel
*
* \returns Returns \p true if the volume has been successfully set
*/
virtual bool setVolume( float volume ) = 0;
protected:
/**
* You can not instantiate channels yourself, use the Factory to
* create them.
*/
Channel( const TQString & channelName, const TQString & type, Direction direction,
TQObject * parent = 0, const char * name = 0 );
private:
class Private;
Private * d;
};
}} // namespaces
// vim: sw=4 ts=4 noet tw=80
#endif // KDEMM_CHANNEL_H

296
kdemm/factory.cpp

@ -0,0 +1,296 @@
/* This file is part of the KDE project
Copyright (C) 2004 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "factory.h"
#include "backend.h"
#include "player.h"
#include "videoplayer.h"
#include "channel.h"
#include <ktrader.h>
#include <kservice.h>
#include <klibloader.h>
#include <kmessagebox.h>
#include <tqfile.h>
#include <klocale.h>
#include <kmimetype.h>
#include <kdebug.h>
namespace KDE
{
namespace Multimedia
{
class Factory::Private
{
public:
Private()
: backend( 0 )
{
createBackend();
}
void createBackend()
{
KTrader::OfferList offers = KTrader::self()->query( "KDEMultimediaBackend", "Type == 'Service'" );
KTrader::OfferListIterator it = offers.begin();
KTrader::OfferListIterator end = offers.end();
TQStringList errormsg;
for( ; it != end; ++it )
{
KService::Ptr ptr = *it;
KLibFactory * factory = KLibLoader::self()->factory( TQFile::encodeName( ptr->library() ) );
if( factory )
{
backend = ( Backend* )factory->create( 0, "Multimedia Backend", "KDE::Multimedia::Backend" );
if