* 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 14 years ago
parent 5f99bff82d
commit 96900dbce3

@ -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

@ -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>

@ -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
{
/*

@ -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';

@ -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";
}

@ -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';

@ -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( )

@ -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 )

@ -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();

@ -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

@ -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;

@ -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"
@ -778,9 +781,14 @@ void KApplication::init(bool GUIenabled)
if ((getuid() != geteuid()) ||
(getgid() != getegid()) )
{
// 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;

@ -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 );
}

@ -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());

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

@ -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;

@ -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;
}

@ -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& );

@ -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();
}

@ -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,6 +719,9 @@ void KStandardDirs::createSpecialResource(const char *type)
{
char hostname[256];
hostname[0] = 0;
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];
@ -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"))

@ -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;
}

@ -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

@ -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)
if(oldNetId != oldName
&& (!xauthlocalhostname || strcmp(xauthlocalhostname, oldNetId.data()) != 0))
continue;
cmd = "xauth remove "+KProcess::quote(netId);
// 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 add ";
}
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.changeDcop();
hn.changeStdDirs("socket");
hn.changeStdDirs("tmp");

@ -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" );
}
}
}

@ -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,6 +262,14 @@ 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);
}
}
@ -269,6 +283,8 @@ void KStyle::unPolish( TQWidget* widget )
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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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

@ -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( 0 == backend )
{
TQString e = i18n( "create method returned 0" );
errormsg.append( e );
kdDebug( 600 ) << "Error getting backend from factory for " <<
ptr->name() << ":\n" << e << endl;
}
else
{
service = ptr;
kdDebug( 600 ) << "using backend: " << ptr->name() << endl;
break;
}
}
else
{
TQString e = KLibLoader::self()->lastErrorMessage();
errormsg.append( e );
kdDebug( 600 ) << "Error getting factory for " << ptr->name() <<
":\n" << e << endl;
}
}
#if 0
if( 0 == backend )
{
if( offers.size() == 0 )
KMessageBox::error( 0, i18n( "Unable to find a Multimedia Backend" ) );
else
{
TQString details = "<qt><table>";
TQStringList::Iterator eit = errormsg.begin();
TQStringList::Iterator eend = errormsg.end();
KTrader::OfferListIterator oit = offers.begin();
KTrader::OfferListIterator oend = offers.end();
for( ; eit != eend || oit != oend; ++eit, ++oit )
details += TQString( "<tr><td><b>%1</b></td><td>%2</td></tr>" )
.arg( ( *oit )->name() ).arg( *eit );
details += "</table></qt>";
KMessageBox::detailedError( 0,
i18n( "Unable to use any of the available Multimedia Backends" ), details );
}
}
#endif
}
Backend * backend;
KService::Ptr service;
TQValueList<void*> objects;
};
Factory * Factory::m_self = 0;
Factory * Factory::self()
{
if( ! m_self )
m_self = new Factory();
return m_self;
}
Factory::Factory()
: DCOPObject( "KDEMMFactory" )
, d( new Private )
{
connectDCOPSignal( 0, 0, "kdemmBackendChanged()", "kdemmBackendChanged()", false);
}
Factory::~Factory()
{
delete d;
}
void Factory::kdemmBackendChanged()
{
if( d->backend )
{
// wouw, if we want to switch on the fly we have to exchange the
// (Video)Player and Channel classes without the API user noticing. That
// would mean to implement a kind of smartwrapper:
// Player: Interface that accesses Player_skel which is abstract and is
// implemented by the Backend. The API user would only get access to the
// Player class and if you want to switch the backend you can delete the
// Player_skel object and put another implementation in its place.
//
// Now we tell the kdemm using app to help us. With the first signal we
// tell 'em to delete all the (Video)Players and Channels and with the
// second to recreate them all again.
emit deleteYourObjects();
if( d->objects.size() > 0 )
{
kdWarning( 600 ) << "we were asked to change the backend but the application did\n"
"not free all references to objects created by the factory. Therefor we can not\n"
"change the backend without crashing. Now we have to wait for a restart to make\n"
"backendswitching possible." << endl;
// in case there were objects deleted give 'em a chance to recreate
// them now
emit recreateObjects();
return;
}
delete d->backend;
d->backend = 0;
}
d->createBackend();
emit recreateObjects();
}
void Factory::objectDestroyed( TQObject * obj )
{
kdDebug( 600 ) << k_funcinfo << obj << endl;
void * p = ( void* )obj;
d->objects.remove( p );
}
Player * Factory::createPlayer()
{
if( d->backend )
{
Player * p = d->backend->createPlayer();
connect( p, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( objectDestroyed( TQObject* ) ) );
d->objects.append( p );
return p;
}
else
return 0;
}
VideoPlayer * Factory::createVideoPlayer()
{
if( d->backend )
{
VideoPlayer * vp = d->backend->createVideoPlayer();
connect( vp, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( objectDestroyed( TQObject* ) ) );
d->objects.append( vp );
return vp;
}
else
return 0;
}
bool Factory::playSoundEvent(const KURL & url)
{
if( d->backend )
return d->backend->playSoundEvent(url);
else
return false;
}
Channel * Factory::createChannel( const TQString & title, const TQString & channeltype,
Channel::Direction direction )
{
if( d->backend )
{
Channel * c = d->backend->createChannel( title, channeltype, direction );
connect( c, TQT_SIGNAL( destroyed( TQObject* ) ), TQT_SLOT( objectDestroyed( TQObject* ) ) );
d->objects.append( c );
return c;
}
else
return 0;
}
TQStringList Factory::availableChannels( Channel::Direction direction ) const
{
if( d->backend )
return d->backend->availableChannels( direction );
else
return TQStringList();
}
TQStringList Factory::playableMimeTypes() const
{
if( d->backend )
return d->backend->playableMimeTypes();
else
return TQStringList();
}
bool Factory::isMimeTypePlayable( const TQString & type ) const
{
if( d->backend )
{
KMimeType::Ptr mimetype = KMimeType::mimeType( type );
TQStringList mimetypes = playableMimeTypes();
for( TQStringList::ConstIterator i=mimetypes.begin(); i!=mimetypes.end(); i++ )
if( mimetype->is( *i ) )
return true;
}
return false;
}
TQString Factory::backendName() const
{
if( d->service )
return d->service->name();
else
return TQString::null;
}
TQString Factory::backendComment() const
{
if( d->service )
return d->service->comment();
else
return TQString::null;
}
TQString Factory::backendVersion() const
{
if( d->service )
return d->service->property( "X-KDE-MMBackendInfo-Version" ).toString();
else
return TQString::null;
}
TQString Factory::backendIcon() const
{
if( d->service )
return d->service->icon();
else
return TQString::null;
}
TQString Factory::backendWebsite() const
{
if( d->service )
return d->service->property( "X-KDE-MMBackendInfo-Website" ).toString();
else
return TQString::null;
}
}} //namespaces
#include "factory.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,222 @@
/* 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_FACTORY_H
#define KDEMM_FACTORY_H
#include <kurl.h>
#include <kdemm/channel.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include <dcopobject.h>
namespace KDE
{
/**
* \brief The KDE Multimedia classes
*
* In this Namespace you find a few classes to access Multimedia functions like
* playing audio files and simple video playing. Those classes are not dependent
* on any specific framework (like they were in pre KDE4 times) but rather use
* exchangeable backends to do the "dirty" work.
*
* If you want to write a new backend you also find the necessary classes in
* this namespace.
*
* \since 4.0
*/
namespace Multimedia
{
class Backend;
class Player;
class VideoPlayer;
/**
* \brief Factory to access the preferred Backend.
*
* This class is your entry point to KDE Multimedia usage. It provides the
* necessary objects for playing audio and video.
*
* For simple access to just playing an audio file see SimplePlayer.
*
* \remarks
* Extensions to the existing functionality can either be added by using the
* reserved virtual functions in Backend or by adding a new interface e.g.
* BackendV2 and creating a BackendV2 instance when the Backend instance is
* created.
*
* \author Matthias Kretz <kretz@kde.org>
* \since 4.0
*/
class KDE_EXPORT Factory : public TQObject, public DCOPObject
{
Q_OBJECT
public:
/**
* Returns a pointer to the factory.
* Use this function to get an instance of KLibLoader.
*
* @return a pointer to the loader. If no loader exists until now then
* one is created
*/
static Factory * self();
/**
* Create a new Player.
*
* You need to call it like this:
* \code
* Factory::self()->createPlayer();
* \endcode
*
* @return a pointer to the Player the backend provides
*/
Player * createPlayer();
/**
* Create a new VideoPlayer object. The Backend does not have to
* implement this functionality so you have to check that it didn't
* return 0.
*
* @return A new instance to a VideoPlayer from the Backend. Or 0 if
* the Backend does not support the VideoPlayer interface.
*/
VideoPlayer * createVideoPlayer();
/**
* Play the specified sound-file with no further control. Returns
* immediatly.
*
* @return if the file was be succesfully issued, but is not a
* garantie for succes of playing the entire file.
*/
bool playSoundEvent(const KURL & url);
/**
* Creates a new Channel object that you can use for a Player object to
* play to.
*
* \param title A user visible title for the Channel. Most of the time
* you will use the application's name.
*
* \param channeltype \ref availableChannels() returns a list of strings
* where you can choose one to be used. Most of the time you will use
* the "default" channel. But the Backend could also provide special
* purpose channels like one for notifications, one for previews and one
* for media playback.
*
* \param direction Whether it's a Channel::Input or Channel::Output
* that you're requesting.
*
* \returns Returns a Channel object or 0 if your request couldn't be
* fullfilled.
*/
Channel * createChannel( const TQString & title,
const TQString & channeltype = TQString::fromLatin1( "default" ),
Channel::Direction direction = Channel::Output );
/**
* Returns the names of the channels that can be used to play or record,
* depending on the value of \p direction.
*
* \param direction If set to Channel::Output you will get the names of
* all output channels, if set to Channel::Input you get the same for
* the input channels.
*/
TQStringList availableChannels( Channel::Direction direction = Channel::Output ) const;
/**
* Returns the mimetypes that can be played.
*/
TQStringList playableMimeTypes() const;
/**
* Checks whether a certain mimetype is playable.
*/
bool isMimeTypePlayable( const TQString & mimetype ) const;
/**
* Get the name of the Backend. It's the name from the .desktop file.
*/
TQString backendName() const;
/**
* Get the comment of the Backend. It's the comment from the .desktop file.
*/
TQString backendComment() const;
/**
* Get the version of the Backend. It's the version from the .desktop file.
*
* The version is especially interesting if there are several versions
* available for binary incompatible versions of the backend's media
* framework.
*/
TQString backendVersion() const;
/**
* Get the icon (name) of the Backend. It's the icon from the .desktop file.
*/
TQString backendIcon() const;
/**
* Get the website of the Backend. It's the website from the .desktop file.
*/
TQString backendWebsite() const;
signals:
/**
* This signal is emitted when the user changes the backend. You then
* have to free all your references to Player or Channel objects.
*/
void deleteYourObjects();
/**
* After you got a deleteYourObjects() signal the backend is changed
* internally. Then you will receive this signal, and only then should
* you reconstruct all your objects again. This time they will
* internally use the new backend.
*/
void recreateObjects();
protected:
Factory();
~Factory();
private slots:
void objectDestroyed( TQObject * );
private:
static Factory * m_self;
class Private;
Private * d;
K_DCOP
k_dcop:
/**
* \internal
* This is called via DCOP when the user changes the KDEMM Backend.
*/
void kdemmBackendChanged();
};
}} // namespaces
#endif // BACKENDFACTORY_H
// vim: sw=4 ts=4 tw=80 noet

@ -0,0 +1,41 @@
/* 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 MIXERIFACE_H
#define MIXERIFACE_H
#include <dcopobject.h>
#include <kdelibs_export.h>
class KDE_EXPORT MixerIface : public DCOPObject
{
K_DCOP
k_dcop:
virtual TQString channelName() const = 0;
virtual TQString channelType() const = 0;
virtual bool hasVolumeControl() const = 0;
virtual float volume() const = 0;
virtual bool setVolume( float volume ) = 0;
protected:
MixerIface() : DCOPObject( "MixerIface" ) {}
};
#endif // MIXERIFACE_H
// vim: sw=4 ts=4 noet tw=80

@ -0,0 +1,30 @@
[Desktop Entry]
Encoding=UTF-8
Type=ServiceType
X-KDE-ServiceType=KDEMultimediaBackend
Name=KDE Multimedia Backend
[PropertyDef::X-KDE-MMBackendInfo-Version]
Type=QString
[PropertyDef::X-KDE-MMBackendInfo-Website]
Type=QString
#[PropertyDef::X-KDE-MMBackendInfo-Supports]
#Type=QStringList
#
#[PropertyDef::X-KDE-MMBackendInfo-Depends]
#Type=QStringList
#
#[PropertyDef::X-KDE-MMBackendInfo-License]
#Type=QString
#
#[PropertyDef::X-KDE-MMBackendInfo-Author]
#Type=QString
#
#[PropertyDef::X-KDE-MMBackendInfo-Email]
#Type=QString
#
#[PropertyDef::X-KDE-MMBackendInfo-Name]
#Type=QString
#

@ -0,0 +1,53 @@
/* 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 "player.h"
namespace KDE {
namespace Multimedia {
Player::Player( TQObject * parent, const char * name )
: TQObject( parent, name )
, m_state( Player::NoMedia )
{
}
Player::~Player()
{
}
Player::State Player::state() const
{
return m_state;
}
void Player::setState( Player::State newstate )
{
if( m_state != newstate )
{
Player::State oldstate = m_state;
m_state = newstate;
emit stateChanged( newstate, oldstate );
}
}
}} // namespaces
#include "player.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,259 @@
/* 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 PLAYOBJECT_H
#define PLAYOBJECT_H
#include <kdelibs_export.h>
#include <tqobject.h>
class KURL;
namespace KDE
{
namespace Multimedia
{
class Channel;
/**
* \short Interface for accessing media playback functions
*
* \author Matthias Kretz <kretz@kde.org>
* \since 4.0
*/
class Player : public QObject
{
Q_OBJECT
public:
/**
* The state the playobject is in at the moment
*/
enum State
{
/**
* The load method wasn't called or didn't succeed. If the
* object is in this state the next thing you have to do is to
* call load.
*/
NoMedia,
/**
* After calling load it might take a while before the Player is
* ready to play(). Normally this doesn't happen for local
* files, but can happen for remote files where the asynchronous
* mimetype detection can take a while.
*/
Loading,
/**
* The Player has a valid media file loaded and is ready for
* playing.
*/
Stopped,
/**
* The Player is playing a media file.
*/
Playing,
/**
* The Player is waiting for data to be able to continue
* playing.
*/
Buffering,
/**
* The Player is paused currently.
*/
Paused
};
virtual ~Player();
/**
* Set the output device the Player should use.
*
* @return Returns \p true on success. If it returns \p false the
* output device wasn't changed. This could happen if you pass a
* Channel with Channel::direction() == Channel::Input.
*/
virtual bool setOutputChannel( Channel * device ) = 0;
/**
* Get the current state.
*/
virtual State state() const;
/**
* Check whether the Player supports to control the volume.
*
* @returns Return \p true if the Player can change its volume.
*/
virtual bool hasVolumeControl() const = 0;
/**
* Get the current volume.
*
* @returns the current volume
*/
virtual float volume() const = 0;
/**
* Get the total time (in milliseconds) of the file currently being played.
*/
virtual long totalTime() const = 0;
/**
* Get the remaining time (in milliseconds) of the file currently being played.
*/
virtual long remainingTime() const = 0;
/**
* Get the current time (in milliseconds) of the file currently being played.
*/
virtual long currentTime() const = 0;
/**
* If the current media may be seeked returns true.
*
* @returns whether the current media may be seeked.
*/
virtual bool seekable() const = 0;
/**
* Return the time interval in milliseconds between two ticks.
*/
virtual long tickInterval() const = 0;
public slots:
/**
* Load a media file. If another media is currently loaded it is
* stopped and unloaded.
*
* @param url The location of the media file
*
* @returns If the call was successfull (the media file was found
* and can be read and decoded) returns \p true
*/
virtual bool load( const KURL & url ) = 0;
/**
* Play the media file.
*/
virtual bool play() = 0;
/**
* Pause a playing media. If it was paused before nothing changes.
*/
virtual bool pause() = 0;
/**
* Stop a playback.
*/
virtual bool stop() = 0;
/**
* Set the volume of the playback
*
* @param volume 0.0 is complete silence and 1.0 is full volume.
* Higher values than 1.0 are possible but might
* result in distortion of the sound.
*
* @returns returns \p true if the call was successfull, returns \p
* false if the volume change didn't work and therefor didn't
* change.
*/
virtual bool setVolume( float volume ) = 0;
/**
* Seek to the time indicated.
*
* @param time The time in milliseconds where to continue playing.
*
* @returns whether the seek was successfull.
*/
virtual bool seek( long time ) = 0;
/**
* Change the interval the tick signal is emitted. If you set \p ms
* to 0 the signal gets disabled.
*
* \param ms tick interval in milliseconds
*
* @returns Returns \p true if the tick intervall was changed.
*/
virtual bool setTickInterval( long ms ) = 0;
signals:
/**
* Emitted when the file has finished playing on its own.
* I.e. it is not emitted if you call stop(), pause() or
* load(), but only on end-of-file or a critical error.
*/
void finished();
//XXX do we want a aboutToFinish() signal?
/**
* Emitted when the state of the Player has changed.
* In case you're not interested in the old state you can also
* connect to a slot that only has one State argument.
*
* @param newstate The state the Player is in now
* @param oldstate The state the Player was in before
*/
void stateChanged( KDE::Multimedia::Player::State newstate, KDE::Multimedia::Player::State oldstate );
/**
* This signal gets emitted every tickInterval milliseconds.
*
* \param time The position of the media file in milliseconds.
*
* \see setTickInterval, tickInterval
*/
void tick( long time );
/**
* This signal is emitted as soon as the length of the media file is
* known or has changed.
*
* @param length The length of the media file in milliseconds.
*/
void length( long length );
protected:
/**
* You can not instantiate players yourself, use the Factory to
* create them.
*/
Player( TQObject * parent, const char * name );
/**
* Call this in your reimplementation for state changes.
* It emits the stateChanged signal if the state has really changed.
*
* @param newstate The new state of the Player. If \p newstate is
* equal to the old state() the call will be ignored.
*/
void setState( State newstate );
private:
class Private;
Private * d;
State m_state;
};
}} //namespaces
// vim: sw=4 ts=4 tw=80 noet
#endif // PLAYOBJECT_H

@ -0,0 +1,533 @@
<HTML><HEAD><TITLE>Requirements & Specification</TITLE></HEAD><BODY BGColor="#FFFFFF" LINK="#0000FF" VLINK="#0000FF">
<H2><CENTER>Requirements & Specification</CENTER></H2>
<A NAME="Problem Statement" />
<H3>1. Problem Statement</H3>
<P>KDE needs to integrate better into existing Multimedia solutions for Linux.</P>
<P>Currently many KDE apps use aRts as media framework and soundserver, while other apps use mplayer, xine and/or gstreamer to do what they need. Sometimes this results in mutually exclusive usage of the soundcard and generally it's an unneeded overhead.</P>
<P>KDE Developers should be able to "natively" use multimedia functions in the KDE API. The KDE Mulitmedia API (short kdemm) should provide an easy to use and Qt/KDE API like aproach to multimedia functionality.</P>
<P>Nowadays when a KDE developer wants to add multimedia functionality to his program he can either choose one framework to do it, write all the media code himself (nobody does this, and probably nobody should) or use an abstraction to be able to use more than one framework. Most of the time the development models (object model, programming language) are not the same as a KDE developer is used to. And very often the API of the framework used is more complicated than the task he wants to accomplish. The kdemm API should be useable without any knowledge about media frameworks and how these things work internally.</P>
<P>The API does not aim to be a general Linux solution to multimedia. It aims to be the solution for all KDE developers.</P>
<P>KDE should ease the use of pro audio tools on Linux and provide the necessary configuration and integration so that for pro audio tools the DE of choice is KDE.</P>
<A NAME="Requirements" />
<H3>2. Requirements</H3>
<A NAME="Actors" />
<H4>2.1. Actors</H4>
<A NAME="Actor: Admin" />
<H4>Actor: Admin</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">Administrates a KDE installation. Most users are their own admins...</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">configure Multimedia sytems</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">Configure kdemm</TD></TR>
</TABLE></P>
<A NAME="Actor: KDE Developer" />
<H4>Actor: KDE Developer</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">The average KDE Developer who might need some multimedia functionality, like playing a media object, for his program.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">add media playback to his program</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">add media playback functionality to a program, initialize kdemm</TD></TR>
</TABLE></P>
<A NAME="Actor: KDE Multimedia Developer" />
<H4>Actor: KDE Multimedia Developer</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">KDE Developer writing a media application like a jukebox or full-featured media player.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">Develop Media Player</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">media playback, manage video window, modify audio path, play media object, load media object, create reusable audio path, crossfading</TD></TR>
</TABLE></P>
<A NAME="Actor: KDE User" />
<H4>Actor: KDE User</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">User of the K Desktop Environment.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated User Tasks</I></TD><TD COLSPAN="1" VALIGN="top">change audio output volume</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiated Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">change audio volume</TD></TR>
</TABLE></P>
<A NAME="User Tasks" />
<H4>2.2. User Tasks</H4>
<P>Actor Admin initilizes the following user tasks</P>
<A NAME="User Task: configure Multimedia sytems" />
<H4>User Task: configure Multimedia sytems</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">His aim is to make all multimedia applications work happily side by side.<BR><BR>He has several options to select, like the audio driver backend to use OSS or ALSA, whether he wants to have a soundserver running and what application uses what audio output. He can set the video output method, like e.g. xv or SDL or plain X.<BR><BR>This has to be done so that applications don't block each other and sometimes to make them interact with one another (like you can do with soundservers).<BR><BR>It is important to have it correctly configured else the user will have problems whenever he uses multimedia programs.<BR><BR>This configuration has to be done once until a new program is installed that is incompatible with the setup. Ideally this task has to be done once and never again.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">Configure kdemm</TD></TR>
</TABLE></P>
<BR>
<BR>
<P>Actor KDE Developer initilizes the following user tasks</P>
<A NAME="User Task: add media playback to his program" />
<H4>User Task: add media playback to his program</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">The average KDE Developer might want to add media playback functionality to his program, meaning that his program will be able to play a sound file or even video file.<BR><BR>He can select from a lot of choices how to achieve his goal.<BR>- write the relevant audio/video code himself<BR>- select and use a media framework like gstreamer or aRts<BR>- use existing code from kdelibs (might not be enough for what he's trying to do)<BR><BR>A lot of programs nowadays need to have multimedia functionality.<BR><BR>It's important that KDE developers can add multimedia functionality to their programs.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">add media playback functionality to a program</TD></TR>
</TABLE></P>
<BR>
<BR>
<P>Actor KDE Multimedia Developer initilizes the following user tasks</P>
<A NAME="User Task: Develop Media Player" />
<H4>User Task: Develop Media Player</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">Aim: The developers aim is to write a full featured media player like mplayer, xine, all the frontends for the former, windoze media player :-P, realplayer, you name it.<BR><BR>Options: He can choose from a variety of available code, like NMM, gstreamer, aRts to a certain extend, mplayer or (lib)xine to provide for his multimedia needs. He can choose how to output the audio and video as far as the former choice gives him options. There are constraints on what media formats he can play or what he can do with the data depending on his choice of media backend/framework.<BR><BR>Reason: A modern desktop environment needs to have a modern media player with all the latest bells and whistles.<BR><BR>Priority: It is important that KDE has "native" media players.<BR><BR>Info-In:<BR>- knowledge about what other media players can do<BR>- features asked for by users (e.g. EQ is a must have for some users)</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">media playback, manage video window, modify audio path, play media object, load media object, create reusable audio path, crossfading</TD></TR>
</TABLE></P>
<BR>
<BR>
<P>Actor KDE User initilizes the following user tasks</P>
<A NAME="User Task: change audio output volume" />
<H4>User Task: change audio output volume</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">The user wants to change the volume of some program because it is too loud compared to the sound of another program.<BR><BR>This is a tricky task for the user if the program itself doesn't allow to attenuate its sound. If it does he can use the volume control of the program. If it doesn't he has to use a soundserver that allows him to use a volume control for this one specific program only.<BR><BR>It is rather important to have this functionality as it can become pretty anoying if you e.g. want to get notifications when people are chatting with you while you're listening to classical music. The notifications really need attenuation.<BR><BR>It might happen a few times a day that a user needs this functionality.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Realized in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">change audio volume</TD></TR>
</TABLE></P>
<A NAME="Domain Data" />
<H4>2.3. Domain Data</H4>
<P>When I say "sent" in the diagram below I'm actually talking about the data flow in the underlying media framework. kdemm only creates connections so that the data flow is done by the framework.</P>
<IMG SRC="0.png" />
<A NAME="Domain Constraints" />
<H4>2.4. Domain Constraints</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%"><B>Network transparency</B></TD><TD >It must be possible to run the desktop over the network, not only the GUI, but also audio output. If it is possible, the system should try to play the audio on the computer where the GUI is shown by default.</TD></TR>
</TABLE></P>
<A NAME="Quality Constraints" />
<H4>2.5. Quality Constraints</H4>
<A NAME="Interaction Data" />
<H4>2.6. Interaction Data</H4>
<A NAME="Specification" />
<H3>3. Specification</H3>
<P>When reading the use cases keep in mind that the user often is the Application Developer. So the actor steps are steps the application written by the developer does.</P>
<A NAME="Use Cases" />
<H4>3.1. Use Cases</H4>
<A NAME="Use Case: add media playback functionality to a program" />
<H4>Use Case: add media playback functionality to a program</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Tell kdemm what media object you want to play back.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Check whether the media object is one of the known types that the backend can decode. If it cannot be decoded error out.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Prepare for being asked to play back the media object, to seek in it or other operations.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >a) Ask for meta information of the current media object. (e.g. length, bitrate, etc.) --> go on with step 5<BR><BR>or<BR><BR>b) asking kdemm to play the media object --> go on with step 7</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">read out meta information, either using the media backend if it supports this function, or using other external libs</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >display meta information on the GUI while asking kdemm to play the media object</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Tell media backend to start playing.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Wait for notification that the media object has finished playing. Remove display of meta info and clean up all used datastructures.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: change audio volume" />
<H4>Use Case: change audio volume</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE User</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >a kdemm using program (let's call it A) is running with its volume being x</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >open KDE Mixer Window</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">look for all available volume controls and show them (with informative description what control does what) to the user</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >locate the control for A and move the fader down</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">decrease the output volume of A</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Postconditions</I></TD><TD >A is running with output volume y < x</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: Configure kdemm" />
<H4>Use Case: Configure kdemm</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >Admin</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >KDE is installed and the backends the Admin wants to use are installed.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >open kdemm admin tool</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">kdemm looks for available options (media frameworks and their output options) and presents these options in a view (see glossary). One framework is already selected as KDE default and kdemm does a good guess (based on audio driver) on what should be the default audio output option.<BR>For the selected media framework there might be more options that need to be shown.<BR>Also if the audio output choice has configuration options they get shown. (e.g. jackd has a lot of options that are more or less important to the admin)</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >select another media framework</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change audio output options according to what the framework supports.<BR><BR>Provide access to the configuration options of the just selected media framework.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >take a look at media framework config options</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">show media framework config options (e.g. NMM might show some network related options here)</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >tweak a few settings</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">write config out so that programs using kdemm behave like configured</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >change default audio output</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Set the media framework to use the specified audio output.<BR><BR>Provide access to the configuration options of the newly selected audio output.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >save settings and close admin tool</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">write out all configuration and tell all kdemm programs to use the new configuration</TD></TR>
</TABLE></P>
<A NAME="Use Case: create reusable audio path" />
<H4>Use Case: create reusable audio path</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm for an "audio path"</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Create a representation for the flow graph audio normally takes from the media object to the output and return an interface to it.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask for a list of effects that can be inserted into the audio path.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Look what effects the media framework supports and return a list that describes those effects (1. information for the end-user, 2. info that a computer program can recognize and identify, 3. unique identifier for the effect)</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Create list of effects and let the user decide what effects he wants. Tell kdemm to insert effects into the audio path.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Prepare an audio path with the selected effects for later use.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >optional steps:<BR>The user decides to configure the parameters of one effect.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Return a Widget showing the parameters the effect has so that the user can configure the effects.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm to save the state of the current audio path to a configuration object.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Look at current audio path, the contained effects and the parameters of the effects. Write those values in the configuration object.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >load media</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Tell kdemm to use the above audio path for the media object.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change flow graph of media framework to use the selected audio path.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >play</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: crossfading" />
<H4>Use Case: crossfading</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm to send a notification 3 seconds before a media object finishes playing.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">tell "notification system" from the media framework if it has one, else start a timer that checks for the end of playback to send the notification</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >take from playlist</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Insert a "Fader" effect into the audio path of the media object</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change flow graph of the media framework to include the "Fader" effect.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >play</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >take from playlist</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Insert a "Fader" effect into the audio path of the media object</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change flow graph of the media framework to include the "Fader" effect.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >When notification arrives tell the Fader of media object 1 to fade out in 3 seconds. Tell the Fader of media object 2 to fade in in 3 seconds and start playing media object 2.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: initialize kdemm" />
<H4>Use Case: initialize kdemm</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >KDE and all its libraries are installed correctly.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >ask kdemm to initialize</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Look at config set by the admin tool and accordingly load the media framework code and initialize an audio output that is at this point already available for the kdemm mixer API.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Postconditions</I></TD><TD >kdemm is initialized and ready for action</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: load media object" />
<H4>Use Case: load media object</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Tell kdemm to load a media object.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Prepare media framework for working with the media object (play, seek, etc.).</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Postconditions</I></TD><TD >Media object is ready for use.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: manage video window" />
<H4>Use Case: manage video window</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm for a dedicated video widget.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Create widget and keep reference to it for so that all video output at some later point can be displayed in this widget.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >optional step - can be inserted at any point from here on:</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Resize video widget (might also be fullscreen display).</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Adjust for new video output size: video needs to be scaled to fit into the widget.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask for available video ratio options.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Ask media framework for available video ratio options. If the media framework doesn't provide any options <BR> Mark the currently used option.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Select one of the ratio options.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change video ratio.</TD></TR>
</TABLE></P>
<A NAME="Use Case: media playback" />
<H4>Use Case: media playback</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Tell kdemm to send a notification whenever a media object is about to finish playing.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">tell "notification system" from the media framework if it has one, else start a timer that checks for the end of playback to send the notification</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Take first media object from the playlist</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >play</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >When notified that the playback is about to end</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >When notified that the playback has finished</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: modify audio path" />
<H4>Use Case: modify audio path</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >the kdemm API has been initialized without errors (see use case "initialize kdemm")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >load</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask for "audio path" of the media object.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Prepare for changing the flow graph of the audio going from the media object to the default output. Return a reference to an object that can be used to modify the path the audio takes.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask for a list of effects that can be inserted into the audio path.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Look what effects the media framework supports and return a list that describes those effects (1. information for the end-user, 2. info that a computer program can recognize and identify, 3. unique identifier for the effect)</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Select an effect and tell kdemm to insert it into the audio path (the position can also be specified)</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Change audio flow graph of the media framework to include the selected effect at the specified position.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >play with effect</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
</TABLE></P>
<A NAME="Use Case: play media object" />
<H4>Use Case: play media object</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Initiating Actor</I></TD><TD >KDE Multimedia Developer</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Preconditions</I></TD><TD >a media object has been loaded (include use case "load media object")</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>FlowSteps</I></TD><TD >Actor</TD><TD COLSPAN="1" VALIGN="top">System</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD >Ask kdemm to play the media.</TD><TD COLSPAN="1" VALIGN="top"></TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I></I></TD><TD ></TD><TD COLSPAN="1" VALIGN="top">Instruct the media framework to play.</TD></TR>
</TABLE></P>
<A NAME="Features" />
<H4>3.2. Features</H4>
<A NAME="Feature: create media object" />
<H4>Feature: create media object</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">Check whether the media data can be accessed and decoded. If not return an error indicating the problem.<BR>Use the underlying media framework to create a flow graph for reading and decoding the media data. (If the media framework does not support reading data from a remote location an extension has to be created that can use KIO to read the data.)<BR>Create an object to represent the media data.</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Inputs</I></TD><TD COLSPAN="1" VALIGN="top">URL to the media data</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Outputs</I></TD><TD COLSPAN="1" VALIGN="top">media object</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Used in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">load media object</TD></TR>
</TABLE></P>
<A NAME="Feature: init notifications" />
<H4>Feature: init notifications</H4>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD WIDTH="20%" VALIGN="top"><I>Description</I></TD><TD COLSPAN="1" VALIGN="top">two cases: <BR>if( The media framework can produce the notification in question ) { <BR>Initialize notifications from media framework and prepare to forward them. <BR>} else { <BR>Use timer to send ticks and check for end of media playback. <BR>}</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Inputs</I></TD><TD COLSPAN="1" VALIGN="top">- time before media playback ends <BR>- time between ticks <BR>- what notifications to enable/disable (choices are: ticks, aboutToEnd, end)</TD></TR>
<TR ><TD WIDTH="20%" VALIGN="top"><I>Used in Use Cases</I></TD><TD COLSPAN="1" VALIGN="top">media playback, crossfading</TD></TR>
</TABLE></P>
<A NAME="Global Functional Constraints" />
<H4>3.3. Global Functional Constraints</H4>
<A NAME="Quality Constraints on Use Cases" />
<H4>3.4. Quality Constraints on Use Cases</H4>
<A NAME="Quality Constraints on Features" />
<H4>3.5. Quality Constraints on Features</H4>
<A NAME="Architectural Constraints" />
<H4>3.6. Architectural Constraints</H4>
<A NAME="User Interface Constraints" />
<H4>3.7. User Interface Constraints</H4>
<A NAME="Examples" />
<H3>4. Examples</H3>
<A NAME="Actor Instances" />
<H4>4.1. Actor Instances</H4>
<A NAME="Scenarios" />
<H4>4.2. Scenarios</H4>
<A NAME="Glossary" />
<H3>5. Glossary</H3>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="2">
<TR ><TD>&nbsp;</TD><TD ><DT>admin options view</DT><DD>The kdemm admin tool shows a selection for the media framework and the audio output. Both define an order in which the kdemm applications try to use the framework/audio output.
Further options can be reached in another view for the media framework and the audio output.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>ALSA</DT><DD>Advanced Linux Sound Architecture: new audio interface for Linux</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>API</DT><DD>Application Programmer Interface: The interface that the Application Programmer uses to interact with the kdemm framework.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>aRts</DT><DD>analog Realtime Synthesizer: the current soundserver and "media framework" of KDE</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>BC</DT><DD>binary compatibility: If the ABI (application binary interface) is changed in an incompatible way (http://developer.kde.org/documentation/other/binarycompatibility.html) the programs using the library will crash.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>DE</DT><DD>Desktop Environment</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>desktop</DT><DD>The GUIs of today all work with the metaphor of a "desktop" on your screen. The elements on screen are the objects that you can handle and work with.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>EQ</DT><DD>equalizer: audio filter to boost and attenuate selected frequencies of the signal</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>flow graph</DT><DD>In media frameworks the flow of media data is modeled as a flow graph. There are nodes representing data sources, data processors and data sinks.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>gstreamer</DT><DD>GStreamer is a library that allows the construction of graphs of media-handling components, ranging from simple Ogg/Vorbis playback to complex audio (mixing) and video (non-linear editing) processing.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>GUI</DT><DD>Graphical User Interface</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>kdemm</DT><DD>short for KDE Multimedia - it's the name of the library/framework the API discussed in here is going to have.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>media object</DT><DD>A media object is a representation for the media data. This could be an audio or video file or stream.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>mplayer</DT><DD>media player that is often used as backend for other media player GUIs</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>NMM</DT><DD>NETWORK-INTEGRATED MULTIMEDIA MIDDLEWARE: a network-integrated multimedia infrastructure for Linux (as well as other operating systems)</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>OSS</DT><DD>Open Sound System: audio interface for UNIX systems</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>SDL</DT><DD>Simple DirectMedia Layer: multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>tick</DT><DD>While playing a media file a common task is to show the current position in the file. A tick is a signal every second or so to notify about the progress.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>URL</DT><DD>Uniform Resource Locator (http://en.wikipedia.org/wiki/Uniform_Resource_Locator)</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>user</DT><DD>As long as I talk about API usage the user equals the AP in API.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>X</DT><DD>X Window system: The client server architecture used for most UNIX GUI programs.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>xine</DT><DD>xine is a free multimedia player. It plays back CDs, DVDs, and VCDs. It also decodes multimedia files like AVI, MOV, WMV, and MP3 from local disk drives, and displays multimedia streamed over the Internet. It interprets many of the most common multimedia formats available - and some of the most uncommon formats, too.</DD></TD></TR>
<TR ><TD>&nbsp;</TD><TD ><DT>xv</DT><DD>X Video: extension to X for hardware accelerated video display</DD></TD></TR>
</TABLE></P>
</BODY></HTML>

@ -0,0 +1,198 @@
/* 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 "simpleplayer.h"
#include <kurl.h>
#include <kglobal.h>
#include <kinstance.h>
#include <kaboutdata.h>
namespace KDE
{
namespace Multimedia
{
class SimplePlayer::Private
{
public:
Channel * channel;
Player * player;
KURL url;
Player::State state;
float channelvolume;
long time;
TQString title;
TQString type;
};
SimplePlayer::SimplePlayer( TQObject * parent, const char * name )
: TQObject( parent, name )
, d( new Private )
{
connect( Factory::self(), TQT_SIGNAL( deleteYourObjects() ), TQT_SLOT( deleteYourObjects() ) );
connect( Factory::self(), TQT_SIGNAL( recreateObjects() ), TQT_SLOT( recreateObjects() ) );
d->channel = Factory::self()->createChannel( KGlobal::instance()->aboutData()->programName() );
d->player = Factory::self()->createPlayer();
if ( d->player ) {
d->player->setOutputChannel( d->channel );
connect( d->player, TQT_SIGNAL( stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State ) ),
TQT_SLOT( stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State ) ) );
connect( d->player, TQT_SIGNAL( finished() ), TQT_SIGNAL( finished() ) );
};
}
SimplePlayer::~SimplePlayer()
{
delete d->player;
delete d->channel;
}
void SimplePlayer::play( const KURL & url )
{
if( ! d->player )
return;
if( isPaused() && url == d->url )
{
d->player->play();
return;
}
if( ! d->player->load( url ) )
return;
d->url = url;
if( d->player->state() == Player::Stopped )
d->player->play();
}
void SimplePlayer::pause()
{
if( ! d->player )
return;
d->player->pause();
}
void SimplePlayer::stop()
{
if( ! d->player )
return;
d->player->stop();
}
long SimplePlayer::totalTime() const
{
if( ! d->player )
return 0;
return d->player->totalTime();
}
long SimplePlayer::currentTime() const
{
if( ! d->player )
return 0;
return d->player->currentTime();
}
void SimplePlayer::seek( long ms )
{
if( ! d->player )
return;
d->player->seek( ms );
}
float SimplePlayer::volume() const
{
if( ! d->player )
return 0;
return d->channel->volume();
}
void SimplePlayer::setVolume( float v )
{
if( ! d->player )
return;
d->channel->setVolume( v );
}
bool SimplePlayer::isPlaying() const
{
if( ! d->player )
return false;
return ( d->player->state() == Player::Playing );
}
bool SimplePlayer::isPaused() const
{
if( ! d->player )
return false;
return ( d->player->state() == Player::Paused );
}
void SimplePlayer::stateChanged( Player::State ns, Player::State os )
{
if( ! d->player )
return;
if( os == Player::Loading && ns == Player::Stopped )
d->player->play();
}
void SimplePlayer::deleteYourObjects()
{
d->state = d->player->state();
d->channelvolume = d->channel->volume();
d->time = d->player->currentTime();
d->title = d->channel->channelName();
d->type = d->channel->channelType();
if( d->player )
d->player->stop();
delete d->player;
delete d->channel;
d->player = 0;
d->channel = 0;
}
void SimplePlayer::recreateObjects()
{
d->channel = Factory::self()->createChannel( d->title, d->type );
d->channel->setVolume( d->channelvolume );
d->player = Factory::self()->createPlayer();
if( ! d->player )
return;
d->player->setOutputChannel( d->channel );
if( d->state != Player::NoMedia )
if( ! d->player->load( d->url ) )
return;
if( d->state == Player::Playing || d->state == Player::Paused || d->state == Player::Buffering )
{
d->player->play();
d->player->seek( d->time );
if( d->state == Player::Paused )
d->player->pause();
}
}
}} // namespaces
#include "simpleplayer.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,72 @@
/* 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 SIMPLEPLAYER_H
#define SIMPLEPLAYER_H
#include <kdemm/factory.h>
#include <kdemm/channel.h>
#include <kdemm/player.h>
#include <tqobject.h>
class KURL;
namespace KDE
{
namespace Multimedia
{
class KDE_EXPORT SimplePlayer : public TQObject
{
Q_OBJECT
public:
SimplePlayer( TQObject * parent = 0, const char * name = 0 );
~SimplePlayer();
void play( const KURL & url );
void pause();
void stop();
long totalTime() const;
long currentTime() const;
void seek( long ms );
float volume() const;
void setVolume( float volume );
bool isPlaying() const;
bool isPaused() const;
signals:
void finished();
private slots:
void stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State );
void deleteYourObjects();
void recreateObjects();
private:
class Private;
Private * d;
};
}} // namespaces
#endif // SIMPLEPLAYER_H
// vim: sw=4 ts=4 noet tw=80

@ -0,0 +1,30 @@
# 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)/kdemm $(all_includes)
METASOURCES = AUTO
check_PROGRAMS = guitest statetest
guitest_SOURCES = main.cpp testwidget.cpp
guitest_LDFLAGS = $(KDE_RPATH) $(all_libraries)
guitest_LDADD = $(LIB_KPARTS) $(top_builddir)/kdemm/libkdemm.la
statetest_SOURCES = statetest.cpp
statetest_LDFLAGS = $(KDE_RPATH) $(all_libraries)
statetest_LDADD = $(top_builddir)/kdemm/libkdemm.la

@ -0,0 +1,38 @@
/* 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 <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
#include "testwidget.h"
int main( int argc, char ** argv )
{
KAboutData about( "kdemmtest", "KDE Multimedia Test",
"0.1", "Testprogram",
KAboutData::License_LGPL, 0 );
about.addAuthor( "Matthias Kretz", 0, "kretz@kde.org" );
KCmdLineArgs::init( argc, argv, &about );
KApplication app;
TestWidget foo;
app.setMainWidget( &foo );
return app.exec();
}
// vim: sw=4 ts=4 noet

@ -0,0 +1,299 @@
/* 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 "statetest.h"
#include <kdemm/factory.h>
#include <kdemm/channel.h>
#include <kdemm/player.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kurl.h>
#include <cstdlib>
using namespace KDE::Multimedia;
kdbgstream& operator<<( kdbgstream & stream, const Player::State state )
{
switch( state )
{
case Player::NoMedia:
stream << "NoMedia";
break;
case Player::Loading:
stream << "Loading";
break;
case Player::Stopped:
stream << "Stopped";
break;
case Player::Playing:
stream << "Playing";
break;
case Player::Buffering:
stream << "Buffering";
break;
case Player::Paused:
stream << "Paused";
break;
}
return stream;
}
void StateTester::run( const KURL & url )
{
/*
check for correct states:
- after construction:
NoMedia
- load()
NoMedia -> NoMedia, (only? for remote files: Loading -> NoMedia, Stopped ), Stopped
- play()
Stopped, Paused -> Playing (except: Stopped -> Stopped)
- when playing:
Playing -> Buffering -> Playing
- pause()
Playing -> Paused
- stop()
Playing, Paused -> Stopped
*/
f = Factory::self();
kdDebug() << "using backend: " << f->backendName() <<
"\n Comment: " << f->backendComment() <<
"\n Version: " << f->backendVersion() << endl;
c = f->createChannel( "teststates" );
p = f->createPlayer();
p->setOutputChannel( c );
connect( p, TQT_SIGNAL( stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State ) ),
TQT_SLOT( stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State ) ) );
connect( p, TQT_SIGNAL( finished() ), kapp, TQT_SLOT( quit() ) );
if( p->state() != Player::NoMedia )
kdDebug() << p->state() << " should be NoMedia" << endl;
kdDebug() << "loading " << url << endl;
if( ! p->load( url ) )
kdDebug() << "load failed" << endl;
if( p->state() == Player::Loading )
kdDebug() << "wait until Player finished Loading" << endl;
else if( p->state() == Player::Stopped )
testplaying();
else if( p->state() == Player::NoMedia )
{
kdDebug() << "could not load media. exiting." << endl;
exit( 0 );
}
}
void StateTester::stateChanged( Player::State newstate, Player::State oldstate )
{
kdDebug() << "stateChanged( new = " << newstate << ", old = " << oldstate << " )" << endl;
switch( oldstate )
{
case Player::NoMedia:
switch( newstate )
{
case Player::NoMedia:
case Player::Loading:
case Player::Stopped:
return;
default:
break;
}
case Player::Loading:
switch( newstate )
{
case Player::NoMedia:
return;
case Player::Stopped:
testplaying();
return;
default:
break;
}
case Player::Stopped:
switch( newstate )
{
case Player::Playing:
case Player::Stopped:
return;
default:
break;
}
case Player::Playing:
switch( newstate )
{
case Player::Buffering:
//testbuffering();
case Player::Paused:
case Player::Stopped:
return;
default:
break;
}
case Player::Buffering:
switch( newstate )
{
case Player::Playing:
case Player::Stopped:
case Player::Paused:
return;
default:
break;
}
case Player::Paused:
switch( newstate )
{
case Player::Playing:
case Player::Stopped:
case Player::Buffering:
return;
default:
break;
}
}
wrongStateChange();
}
void StateTester::testplaying()
{
if( ! p->play() )
kdDebug() << "play failed" << endl;
if( p->state() == Player::Stopped )
{
kdDebug() << "could not play media. exiting." << endl;
exit( 0 );
}
else if( p->state() == Player::Playing )
{
if( ! p->pause() )
{
kdDebug() << "pause failed" << endl;
if( p->state() != Player::Playing )
wrongStateChange();
}
else
{
if( p->state() != Player::Paused )
wrongStateChange();
if( ! p->play() )
{
kdDebug() << "play failed" << endl;
if( p->state() != Player::Paused )
wrongStateChange();
kdError() << "what now? play shouldn't fail here" << endl;
exit( 1 );
}
if( p->state() != Player::Playing )
wrongStateChange();
}
// it's playing now
if( ! p->stop() )
{
kdDebug() << "stop failed" << endl;
if( p->state() != Player::Playing )
wrongStateChange();
}
else
{
if( p->state() != Player::Stopped )
wrongStateChange();
if( ! p->play() )
{
kdDebug() << "play failed" << endl;
if( p->state() != Player::Stopped )
wrongStateChange();
kdError() << "play shouldn't fail after it worked before. exiting." << endl;
exit( 1 );
}
}
// it's playing again
if( ! p->pause() )
{
kdDebug() << "pause failed. exiting." << endl;
exit( 1 );
}
if( p->state() != Player::Paused )
wrongStateChange();
if( ! p->stop() )
{
kdDebug() << "stop failed" << endl;
if( p->state() != Player::Paused )
wrongStateChange();
exit( 1 );
}
if( p->state() != Player::Stopped )
wrongStateChange();
// do further checking, calling load again
kdDebug() << "success! playing the last 1/5 of the file now and quit on the finished signal" << endl;
p->play();
p->seek( p->totalTime() * 4 / 5 );
}
}
void StateTester::wrongStateChange()
{
kdError() << "wrong state change in backend!" << endl;
exit( 1 );
}
static const KCmdLineOptions options[] =
{
{ "+url", I18N_NOOP( "media file to play" ), 0 },
KCmdLineLastOption // End of options.
};
int main( int argc, char ** argv )
{
KAboutData about( "kdemmtest", "KDE Multimedia Test",
"0.1", "Testprogram",
KAboutData::License_LGPL, 0 );
about.addAuthor( "Matthias Kretz", 0, "kretz@kde.org" );
KCmdLineArgs::init( argc, argv, &about );
KCmdLineArgs::addCmdLineOptions( options );
KApplication app; // we need it for KTrader
StateTester tester;
if( KCmdLineArgs::parsedArgs()->count() > 0 )
tester.run( KCmdLineArgs::parsedArgs()->url( 0 ) );
else
{
KCmdLineArgs::usage();
exit( 2 );
}
return app.exec();
}
#include "statetest.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,57 @@
/* 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 STATETEST_H
#define STATETEST_H
#include <tqobject.h>
#include <kdemm/player.h>
class KURL;
namespace KDE
{
namespace Multimedia
{
class Factory;
class Channel;
}
}
class StateTester : public QObject
{
Q_OBJECT
public:
void run( const KURL & );
private slots:
void stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State );
private:
void testplaying();
void wrongStateChange();
KDE::Multimedia::Factory * f;
KDE::Multimedia::Channel * c;
KDE::Multimedia::Player * p;
};
#endif // STATETEST_H
// vim: sw=4 ts=4 noet

@ -0,0 +1,194 @@
/* 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 "testwidget.h"
#include <kdemm/factory.h>
#include <kdemm/player.h>
#include <kdemm/channel.h>
#include <klocale.h>
#include <kdebug.h>
#include <kurl.h>
#include <tqslider.h>
#include <tqlayout.h>
#include <tqapplication.h>
#include <tqpushbutton.h>
#include <tqlabel.h>
#include <klineedit.h>
#include <kurlcompletion.h>
using namespace KDE::Multimedia;
TestWidget::TestWidget()
: TQWidget( 0, 0 )
, m_ticking( false )
{
c = Factory::self()->createChannel( i18n( "KDE Multimedia testprogram" ) );
if( ! c )
kdFatal() << "couldn't create outputdevice" << endl;
po = Factory::self()->createPlayer();
if( ! po )
kdFatal() << "couldn't create Player" << endl;
if( ! po->setOutputChannel( c ) )
kdFatal() << "PlayObject::setOutputChannel failed" << endl;
if( ! po->state() == Player::NoMedia )
kdFatal() << "PlayObject in wrong state 1" << endl;
( new TQHBoxLayout( this ) )->setAutoAdd( true );
m_v1slider = new TQSlider( this );
m_v1slider->setRange( 0, 150 );
m_v1slider->setValue( ( int )( 100 * po->volume() ) );
connect( m_v1slider, TQT_SIGNAL( valueChanged( int ) ), TQT_SLOT( v1changed( int ) ) );
m_v2slider = new TQSlider( this );
m_v2slider->setRange( 0, 150 );
m_v2slider->setValue( ( int )( 100 * c->volume() ) );
connect( m_v2slider, TQT_SIGNAL( valueChanged( int ) ), TQT_SLOT( v2changed( int ) ) );
TQFrame * frame = new TQFrame( this );
( new TQVBoxLayout( frame ) )->setAutoAdd( true );
m_seekslider = new TQSlider( frame );
m_seekslider->setOrientation( Qt::Horizontal );
connect( m_seekslider, TQT_SIGNAL( valueChanged( int ) ), TQT_SLOT( seek( int ) ) );
po->setTickInterval( 100 );
connect( po, TQT_SIGNAL( tick( long ) ), TQT_SLOT( tick( long ) ) );
connect( po, TQT_SIGNAL( length( long ) ), TQT_SLOT( length( long ) ) );
m_statelabel = new TQLabel( frame );
connect( po, TQT_SIGNAL( stateChanged( KDE::Multimedia::Player::State, KDE::Multimedia::Player::State ) ),
TQT_SLOT( stateChanged( KDE::Multimedia::Player::State ) ) );
stateChanged( po->state() );
TQPushButton * pause = new TQPushButton( frame );
pause->setText( "pause" );
connect( pause, TQT_SIGNAL( clicked() ), po, TQT_SLOT( pause() ) );
TQPushButton * play = new TQPushButton( frame );
play->setText( "play" );
connect( play, TQT_SIGNAL( clicked() ), po, TQT_SLOT( play() ) );
TQPushButton * stop = new TQPushButton( frame );
stop->setText( "stop" );
connect( stop, TQT_SIGNAL( clicked() ), po, TQT_SLOT( stop() ) );
KLineEdit * file = new KLineEdit( frame );
file->setCompletionObject( new KURLCompletion( KURLCompletion::FileCompletion ) );
connect( file, TQT_SIGNAL( returnPressed( const TQString & ) ), TQT_SLOT( loadFile( const TQString & ) ) );
TQFrame * frame2 = new TQFrame( this );
( new TQVBoxLayout( frame2 ) )->setAutoAdd( true );
m_volumelabel1 = new TQLabel( frame2 );
m_volumelabel1->setText( TQString::number( po->volume() ) );
m_volumelabel2 = new TQLabel( frame2 );
m_volumelabel2->setText( TQString::number( c->volume() ) );
m_totaltime = new TQLabel( frame2 );
m_totaltime->setText( TQString::number( po->totalTime() ) );
m_currenttime = new TQLabel( frame2 );
m_currenttime->setText( TQString::number( po->currentTime() ) );
m_remainingtime = new TQLabel( frame2 );
m_remainingtime->setText( TQString::number( po->remainingTime() ) );
show();
if( ! po->load( KURL( "/home/mkretz/Musik/qt23.mp3" ) ) )
kdFatal() << "PlayObject::load failed" << endl;
connect( po, TQT_SIGNAL( finished() ), qApp, TQT_SLOT( quit() ) );
}
void TestWidget::v1changed( int v )
{
if( ! po->setVolume( ( ( float )v ) / 100 ) )
kdDebug() << "setVolume1 failed" << endl;
m_volumelabel1->setText( TQString::number( po->volume() ) );
}
void TestWidget::v2changed( int v )
{
if( ! c->setVolume( ( ( float )v ) / 100 ) )
kdDebug() << "setVolume2 failed" << endl;
m_volumelabel2->setText( TQString::number( c->volume() ) );
}
void TestWidget::tick( long t )
{
m_ticking = true;
m_seekslider->setValue( t );
m_currenttime->setText( TQString::number( po->currentTime() ) );
m_remainingtime->setText( TQString::number( po->remainingTime() ) );
m_ticking = false;
}
void TestWidget::stateChanged( Player::State newstate )
{
switch( newstate )
{
case Player::NoMedia:
m_statelabel->setText( "NoMedia" );
break;
case Player::Loading:
m_statelabel->setText( "Loading" );
break;
case Player::Stopped:
m_statelabel->setText( "Stopped" );
break;
case Player::Paused:
m_statelabel->setText( "Paused" );
break;
case Player::Buffering:
m_statelabel->setText( "Buffering" );
break;
case Player::Playing:
m_statelabel->setText( "Playing" );
break;
}
}
void TestWidget::seek( int ms )
{
if( ! m_ticking )
po->seek( ms );
}
void TestWidget::length( long ms )
{
m_seekslider->setRange( 0, ms );
m_totaltime->setText( TQString::number( po->totalTime() ) );
m_currenttime->setText( TQString::number( po->currentTime() ) );
m_remainingtime->setText( TQString::number( po->remainingTime() ) );
}
void TestWidget::loadFile( const TQString & file )
{
po->load( KURL( file ) );
}
#include "testwidget.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,64 @@
/* 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 TESTWIDGET_H
#define TESTWIDGET_H
#include <tqwidget.h>
#include <kdemm/player.h>
class TQSlider;
class TQLabel;
class TQString;
namespace KDE
{
namespace Multimedia
{
class Channel;
}
}
using namespace KDE::Multimedia;
class TestWidget : public QWidget
{
Q_OBJECT
public:
TestWidget();
private slots:
void v1changed( int );
void v2changed( int );
void tick( long );
void stateChanged( KDE::Multimedia::Player::State );
void seek( int );
void length( long );
void loadFile( const TQString & );
private:
TQSlider *m_v1slider, *m_v2slider, *m_seekslider;
TQLabel *m_statelabel, *m_volumelabel1, *m_volumelabel2, *m_totaltime, *m_currenttime, *m_remainingtime;
Channel * c;
Player * po;
bool m_ticking;
};
#endif // TESTWIDGET_H
// vim: sw=4 ts=4 noet

@ -0,0 +1,34 @@
/* 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 "videoplayer.h"
namespace KDE
{
namespace Multimedia
{
VideoPlayer::VideoPlayer( TQObject * parent, const char * name )
: Player( parent, name )
{
}
}} // namespaces
#include "videoplayer.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,54 @@
/* 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 VIDEOPLAYER_H
#define VIDEOPLAYER_H
#include "player.h"
namespace KDE
{
namespace Multimedia
{
class VideoPlayer : public Player
{
Q_OBJECT
public:
/**
* Create a widget that will show the video.
*
* \param parent The parent to use for the video widget
* \param name The TQObject name for the widget
*
* \returns Returns the video widget.
*/
virtual TQWidget * createVideoWidget( TQWidget * parent, const char * name ) = 0;
protected:
/**
* You can not instantiate players yourself, use the Factory to
* create them.
*/
VideoPlayer( TQObject * parent, const char * name );
};
}} //namespaces
#endif // VIDEOPLAYER_H
// vim: sw=4 ts=4 tw=80 noet

@ -0,0 +1,31 @@
# 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.
INCLUDES = -I$(top_srcdir) $(all_includes)
kde_module_LTLIBRARIES = kded_volumecontrold.la
kded_volumecontrold_la_LDFLAGS = $(all_libraries) -module -avoid-version
kded_volumecontrold_la_LIBADD = ../libkdemm.la
kded_volumecontrold_la_SOURCES = volumecontrold.cpp volumecontrold.skel
METASOURCES = AUTO
noinst_HEADERS = volumecontrold.h
services_DATA = volumecontrold.desktop
servicesdir = $(kde_servicesdir)/kded

@ -0,0 +1,47 @@
/* 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 "volumecontrold.h"
#include <kapplication.h>
#include <dcopclient.h>
extern "C"
{
KDEDModule * create_volumecontrold( const TQCString &name )
{
return new VolumeControlD( name );
}
}
class VolumeControlD::Private
{
public:
};
VolumeControlD::VolumeControlD( const TQCString & name )
: KDEDModule( name )
{
connect( KApplication::dcopClient(), TQT_SIGNAL( applicationRemoved( const TQCString & ) ),
TQT_SLOT( applicationRemoved( const TQCString& ) ) );
}
#include "volumecontrold.moc"
// vim: sw=4 ts=4 noet

@ -0,0 +1,13 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
ServiceTypes=KDEDModule
X-KDE-ModuleType=Library
X-KDE-Library=volumecontrold
X-KDE-FactoryName=volumecontrold
X-KDE-Kded-autoload=false
X-KDE-Kded-load-on-demand=true
Name=Volume Control
Comment=volume control daemon module for KDED

@ -0,0 +1,53 @@
/* 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 VOLUMECONTROLD_H
#define VOLUMECONTROLD_H
#include <kded/kdedmodule.h>
#include <tqstringlist.h>
class VolumeControlD : public KDEDModule
{
Q_OBJECT
K_DCOP
public:
VolumeControlD(const TQCString &name);
virtual ~VolumeControlD();
k_dcop:
// think of some better API here...
TQStringList availableChannels() const;
TQStringList openConnectionsToChannel( const TQString & channel ) const;
float volume( const TQString & connection, const TQString & channel ) const;
void setVolume( const TQString & connection, const TQString & channel, float volume );
private slots:
/**
* When an app with a registered Channel goes down we want to notice...
*/
void applicationRemoved( const TQCString & );
private:
class Private;
Private * d;
};
// vim: sw=4 ts=4 tw=80 noet
#endif // VOLUMECONTROLD_H

@ -45,6 +45,7 @@
#include <kguiitem.h>
#include <kprocess.h>
#include <stdlib.h>
#include <signal.h>
#include <cups/cups.h>

@ -85,7 +85,7 @@ static int trials = 5;
// change LANG variable so that CUPS is always using
// english language: translation may only come from the PPD
// itself, or from KDE.
setenv("LANG", "en", 1);
setenv("LANG", "en_US.UTF-8", 1);
}
KMCupsManager::~KMCupsManager()

@ -179,7 +179,7 @@ void KMVirtualManager::setAsDefault(KMPrinter *p, const TQString& name, TQWidget
void KMVirtualManager::refresh()
{
QFileInfo fi(TQDir::homeDirPath() + TQFile::decodeName("/.lpoptions"));
QFileInfo fi(TQDir::homeDirPath() + TQFile::decodeName("/.cups/.lpoptions"));
QFileInfo fi2(TQFile::decodeName("/etc/cups/lpoptions"));
// if root, then only use global file: trick -> use twice the same file
@ -301,7 +301,13 @@ void KMVirtualManager::triggerSave()
filename = TQFile::decodeName("/etc/cups/lpoptions");
}
else
filename = TQDir::homeDirPath() + TQFile::decodeName("/.lpoptions");
{
TQDir cupsDir(TQDir::home().absPath()+"/.cups");
if (!cupsDir.exists())
cupsDir.mkdir(TQDir::home().absPath()+"/.cups");
filename = TQDir::homeDirPath() + TQFile::decodeName("/.cups/lpoptions");
}
if (!filename.isEmpty())
{
saveFile(filename);

@ -108,6 +108,9 @@ static KLibFactory* componentFactory()
{
kdDebug(500) << "kdeprint: querying trader for 'application/postscript' service" << endl;
KLibFactory *factory(0);
factory = KLibLoader::self()->factory("libkghostviewpart");
if( factory )
return factory;
KTrader::OfferList offers = KTrader::self()->query(TQString::fromLatin1("application/postscript"), TQString::fromLatin1("KParts/ReadOnlyPart"), TQString::null, TQString::null);
for (KTrader::OfferList::ConstIterator it = offers.begin(); it != offers.end(); ++it)
{

@ -184,15 +184,25 @@ void SmbView::setOpen(TQListViewItem *item, bool on)
}
else if (item->depth() == 1)
{ // opening server
char *krb5ccname = getenv ("KRB5CCNAME");
m_current = item;
if (krb5ccname)
{
*m_proc << "smbclient -k -N -L ";
}
else
{
*m_proc << "smbclient -N -L ";
}
*m_proc << KProcess::quote (item->text (0));
*m_proc << " -W ";
*m_proc << KProcess::quote(item->parent()->text(0));
if (m_login != TQString::null)
*m_proc << KProcess::quote (item->parent ()->
text (0));
if (!krb5ccname)
{
*m_proc << " -A ";
*m_proc << KProcess::quote(m_passwdFile->name());
*m_proc << KProcess::
quote (m_passwdFile->name ());
}
startProcess(ShareListing);
}

@ -13,8 +13,9 @@
#ifndef __Defaults_h_included__
#define __Defaults_h_included__
/*const int defTimeout = 120*60;*/
const int defTimeout = 120*60;
const int defEchoMode = 0;
const int defKeep = false;
const int defKeep = true;
#endif

@ -20,7 +20,7 @@
SUBDIRS = . tests about kdetrayproxy
INCLUDES= -I$(top_srcdir)/kdefx -I$(top_srcdir)/interfaces $(all_includes)
INCLUDES= -I/usr/include/freetype2/ -I$(top_srcdir)/kdefx -I$(top_srcdir)/interfaces $(all_includes)
# For the future: examine if condensing the tons of *_LDFLAGS variables
# into $(all_libraries) isn't better

@ -42,6 +42,17 @@
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <X11/Xdefs.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xft/Xft.h>
/**
* How it works.
* KActionCollection is an organizing container for KActions.

@ -27,6 +27,9 @@
#include "kactionclasses.h"
#include <assert.h>
#include <ft2build.h>
#include FT_FREETYPE_H
#include <fontconfig/fontconfig.h>
#include <tqcursor.h>
#include <tqclipboard.h>
@ -35,6 +38,7 @@
#include <tqwhatsthis.h>
#include <tqtimer.h>
#include <tqfile.h>
#include <tqregexp.h>
#include <dcopclient.h>
#include <dcopref.h>
@ -1498,6 +1502,23 @@ void KFontAction::setFont( const TQString &family )
return;
}
}
// nothing matched yet, try a fontconfig reverse lookup and
// check again to solve an alias
FcPattern *pattern = NULL;
FcConfig *config = NULL;
TQString realFamily;
TQRegExp regExp("[-:]");
pattern = FcNameParse( (unsigned char*) family.ascii() );
FcDefaultSubstitute(pattern);
FcConfigSubstitute (config, pattern, FcMatchPattern);
pattern = FcFontMatch(NULL, pattern, NULL);
realFamily = (char*)FcNameUnparse(pattern);
realFamily.remove(realFamily.find(regExp), realFamily.length());
if ( !realFamily.isEmpty() && realFamily != family )
setFont( realFamily );
else
kdDebug(129) << "Font not found " << family.lower() << endl;
}

@ -29,6 +29,7 @@
#include <kcursor.h>
#include <kiconloader.h>
#include <kicontheme.h>
#include <klistviewsearchline.h>
#include <klineedit.h>
#include <klocale.h>
#include <knotifyclient.h>
@ -343,10 +344,22 @@ void KComboBox::lineEditDeleted()
// *********************************************************************
// *********************************************************************
class KHistoryCombo::KHistoryComboPrivate
{
public:
KHistoryComboPrivate() : bHistoryEditorEnabled(false)
{
}
~KHistoryComboPrivate()
{
}
bool bHistoryEditorEnabled;
};
// we are always read-write
KHistoryCombo::KHistoryCombo( TQWidget *parent, const char *name )
: KComboBox( true, parent, name ), d(0)
: KComboBox( true, parent, name ), d(new KHistoryComboPrivate)
{
init( true ); // using completion
}
@ -354,7 +367,7 @@ KHistoryCombo::KHistoryCombo( TQWidget *parent, const char *name )
// we are always read-write
KHistoryCombo::KHistoryCombo( bool useCompletion,
TQWidget *parent, const char *name )
: KComboBox( true, parent, name ), d(0)
: KComboBox( true, parent, name ), d(new KHistoryComboPrivate)
{
init( useCompletion );
}
@ -441,6 +454,10 @@ void KHistoryCombo::addContextMenuItems( TQPopupMenu* menu )
if ( menu )
{
menu->insertSeparator();
if (d->bHistoryEditorEnabled) {
int idedit = menu->insertItem( SmallIconSet("edit"), i18n("&Edit History..."), this, TQT_SLOT( slotEdit()) );
menu->setItemEnabled(idedit, count());
}
int id = menu->insertItem( SmallIconSet("history_clear"), i18n("Clear &History"), this, TQT_SLOT( slotClear()));
if (!count())
menu->setItemEnabled(id, false);
@ -677,10 +694,104 @@ void KHistoryCombo::slotClear()
emit cleared();
}
void KHistoryCombo::slotEdit()
{
KHistoryComboEditor dlg( historyItems(), this );
connect( &dlg, TQT_SIGNAL( removeFromHistory(const TQString&) ), TQT_SLOT( slotRemoveFromHistory(const TQString&)) );
dlg.exec();
}
void KHistoryCombo::slotRemoveFromHistory(const TQString &entry)
{
removeFromHistory(entry);
emit removed(entry);
}
void KHistoryCombo::setHistoryEditorEnabled( bool enable )
{
d->bHistoryEditorEnabled = enable;
}
bool KHistoryCombo::isHistoryEditorEnabled() const
{
return d->bHistoryEditorEnabled;
}
void KComboBox::virtual_hook( int id, void* data )
{ KCompletionBase::virtual_hook( id, data ); }
void KHistoryCombo::virtual_hook( int id, void* data )
{ KComboBox::virtual_hook( id, data ); }
void KHistoryComboEditor::virtual_hook( int id, void* data )
{ KDialogBase::virtual_hook( id, data ); }
KHistoryComboEditor::KHistoryComboEditor( const TQStringList& entries, TQWidget *parent )
: KDialogBase( parent, "khistorycomboeditor", true, i18n( "History Editor" ),
KDialogBase::Close | KDialogBase::User1, KDialogBase::User1, true,
KGuiItem( i18n( "&Delete Entry" ), "editdelete") ), d(0)
{
TQVBox* box = new TQVBox( this );
box->setSpacing( KDialog::spacingHint() );
setMainWidget( box );
new TQLabel( i18n( "This dialog allows you to delete unwanted history items." ), box );
// Add searchline
TQHBox* searchbox = new TQHBox( box );
searchbox->setSpacing( KDialog::spacingHint() );
TQToolButton *clearSearch = new TQToolButton(searchbox);
clearSearch->setTextLabel(i18n("Clear Search"), true);
clearSearch->setIconSet(SmallIconSet(TQApplication::reverseLayout() ? "clear_left" : "locationbar_erase"));
TQLabel* slbl = new TQLabel(i18n("&Search:"), searchbox);
KListViewSearchLine* listViewSearch = new KListViewSearchLine(searchbox);
slbl->setBuddy(listViewSearch);
connect(clearSearch, TQT_SIGNAL(pressed()), listViewSearch, TQT_SLOT(clear()));
// Add ListView
m_pListView = new KListView( box );
listViewSearch->setListView(m_pListView);
m_pListView->setAllColumnsShowFocus(true);
m_pListView->header()->hide();
m_pListView->addColumn("");
m_pListView->setRenameable( 0 );
box->setStretchFactor( m_pListView, 1 );
TQStringList newlist = entries;
for ( TQStringList::Iterator it = newlist.begin(); it != newlist.end(); ++it ) {
new TQListViewItem( m_pListView, *it );
}
m_pListView->setMinimumSize( m_pListView->sizeHint() );
connect( m_pListView, TQT_SIGNAL( selectionChanged( TQListViewItem * ) ),
this, TQT_SLOT( slotSelectionChanged( TQListViewItem * ) ) );
enableButton( KDialogBase::User1, false );
resize( sizeHint() );
}
KHistoryComboEditor::~KHistoryComboEditor()
{
}
void KHistoryComboEditor::slotUser1() // Delete button
{
TQListViewItem *item = m_pListView->selectedItem();
if ( item ) {
emit removeFromHistory( item->text(0) );
m_pListView->takeItem( item );
enableButton( KDialogBase::User1, false );
}
}
void KHistoryComboEditor::slotSelectionChanged( TQListViewItem * item )
{
enableButton( KDialogBase::User1, item );
}
#include "kcombobox.moc"

@ -24,8 +24,15 @@
#include <tqlineedit.h>
#include <tqcombobox.h>
#include <tqvbox.h>
#include <tqlabel.h>
#include <tqlayout.h>
#include <tqtoolbutton.h>
#include <tqheader.h>
#include <kcompletion.h>
#include <kdialogbase.h>
#include <klistview.h>
class TQListBoxItem;
class TQPopupMenu;
@ -669,6 +676,12 @@ public:
*/
void reset() { slotReset(); }
/**
* When enabling it you have to connect to "removed" signal and save changes
*/
void setHistoryEditorEnabled( bool enable );
bool isHistoryEditorEnabled() const;
public slots:
/**
* Adds an item to the end of the history list and to the completion list.
@ -702,6 +715,8 @@ signals:
*/
void cleared();
void removed( const TQString& item );
protected:
/**
* Handling key-events, the shortcuts to rotate the items.
@ -740,11 +755,18 @@ private slots:
*/
void slotClear();
/**
* Called from the popupmenu,
*/
void slotEdit();
/**
* Appends our own context menu entry.
*/
void addContextMenuItems( TQPopupMenu* );
void slotRemoveFromHistory( const TQString & );
private:
void init( bool useCompletion );
void rotateUp();
@ -774,6 +796,30 @@ private:
KHistoryComboPrivate* const d;
};
class KDEUI_EXPORT KHistoryComboEditor : public KDialogBase
{
Q_OBJECT
public:
KHistoryComboEditor( const TQStringList& entries, TQWidget *parent = 0L );
~KHistoryComboEditor();
signals:
void removeFromHistory( const TQString& );
protected slots:
virtual void slotUser1(); // User1 is "Delete Entry" button
void slotSelectionChanged( TQListViewItem * item );
protected:
virtual void virtual_hook( int id, void* data );
private:
KListView *m_pListView;
class KHistoryComboEditorPrivate;
KHistoryComboEditorPrivate* const d;
};
#endif

@ -20,6 +20,7 @@
#include <tqfontdatabase.h>
#include <tqlistbox.h>
#include <tqpainter.h>
#include <tqregexp.h>
#include <kcharsets.h>
#include <kconfig.h>
@ -29,6 +30,18 @@
#include "kfontcombo.h"
#include "kfontcombo.moc"
#include <ft2build.h>
#include FT_FREETYPE_H
#include <fontconfig/fontconfig.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Shell.h>
#include <X11/Xft/Xft.h>
struct KFontComboPrivate
{
KFontComboPrivate()
@ -227,6 +240,22 @@ void KFontCombo::setCurrentFont(const TQString &family)
return;
}
}
// nothing matched yet, try a fontconfig reverse lookup and
// check again to solve an alias
FcPattern *pattern = NULL;
FcConfig *config = NULL;
TQString realFamily;
TQRegExp regExp("[-:]");
pattern = FcNameParse( (unsigned char*) family.ascii() );
FcDefaultSubstitute(pattern);
FcConfigSubstitute (config, pattern, FcMatchPattern);
pattern = FcFontMatch(NULL, pattern, NULL);
realFamily = (char*)FcNameUnparse(pattern);
realFamily.remove(realFamily.find(regExp), realFamily.length());
if ( !realFamily.isEmpty() && realFamily != family )
setCurrentFont( realFamily );
}
void KFontCombo::slotModified( int )

@ -53,12 +53,15 @@ class KJanusWidget::IconListItem : public QListBoxItem
virtual int height( const TQListBox *lb ) const;
virtual int width( const TQListBox *lb ) const;
int expandMinimumWidth( int width );
void highlight( bool erase );
protected:
const TQPixmap &defaultPixmap();
void paint( TQPainter *painter );
private:
void paintContents( TQPainter *painter );
TQPixmap mPixmap;
int mMinimumWidth;
};
@ -141,6 +144,8 @@ KJanusWidget::KJanusWidget( TQWidget *parent, const char *name, int face )
mIconList->verticalScrollBar()->installEventFilter( this );
connect( mIconList, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotShowPage()));
connect( mIconList, TQT_SIGNAL(onItem(TQListBoxItem *)), TQT_SLOT(slotOnItem(TQListBoxItem *)));
hbox->addSpacing( KDialog::marginHint() );
page = new TQFrame( this );
hbox->addWidget( page, 10 );
@ -721,6 +726,12 @@ void KJanusWidget::slotItemClicked(TQListViewItem *it)
it->setOpen(!it->isOpen());
}
// hack because qt does not support Q_OBJECT in nested classes
void KJanusWidget::slotOnItem(TQListBoxItem *qitem)
{
mIconList->slotOnItem( qitem );
}
void KJanusWidget::setFocus()
{
if( !mValid ) { return; }
@ -929,11 +940,11 @@ bool KJanusWidget::eventFilter( TQObject *o, TQEvent *e )
KJanusWidget::IconListBox::IconListBox( TQWidget *parent, const char *name,
WFlags f )
:KListBox( parent, name, f ), mShowAll(false), mHeightValid(false),
mWidthValid(false)
mWidthValid(false),
mOldItem(0)
{
}
void KJanusWidget::IconListBox::updateMinimumHeight()
{
if( mShowAll && !mHeightValid )
@ -995,6 +1006,45 @@ void KJanusWidget::IconListBox::setShowAll( bool showAll )
}
void KJanusWidget::IconListBox::leaveEvent( TQEvent *ev )
{
KListBox::leaveEvent( ev );
if ( mOldItem && !mOldItem->isSelected() )
{
((KJanusWidget::IconListItem *) mOldItem)->highlight( true );
mOldItem = 0;
}
}
// hack because qt does not support Q_OBJECT in nested classes
void KJanusWidget::IconListBox::slotOnItem(TQListBoxItem *qitem)
{
KListBox::slotOnItem( qitem );
if ( qitem == mOldItem )
{
return;
}
if ( mOldItem && !mOldItem->isSelected() )
{
((KJanusWidget::IconListItem *) mOldItem)->highlight( true );
}
KJanusWidget::IconListItem *item = dynamic_cast< KJanusWidget::IconListItem * >( qitem );
if ( item && !item->isSelected() )
{
item->highlight( false );
mOldItem = item;
}
else
{
mOldItem = 0;
}
}
KJanusWidget::IconListItem::IconListItem( TQListBox *listbox, const TQPixmap &pixmap,
const TQString &text )
@ -1006,6 +1056,7 @@ KJanusWidget::IconListItem::IconListItem( TQListBox *listbox, const TQPixmap &pi
mPixmap = defaultPixmap();
}
setText( text );
setCustomHighlighting( true );
mMinimumWidth = 0;
}
@ -1017,6 +1068,36 @@ int KJanusWidget::IconListItem::expandMinimumWidth( int width )
}
void KJanusWidget::IconListItem::highlight( bool erase )
{
TQRect r = listBox()->itemRect( this );
r.addCoords( 1, 1, -1, -1 );
TQPainter p( listBox()->viewport() );
p.setClipRegion( r );
const TQColorGroup &cg = listBox()->colorGroup();
if ( erase )
{
p.setPen( cg.base() );
p.setBrush( cg.base() );
p.drawRect( r );
}
else
{
p.setBrush( cg.highlight().light( 120 ) );
p.drawRect( r );
p.setPen( cg.highlight().dark( 140 ) );
p.drawRect( r );
}
p.setPen( cg.foreground() );
p.translate( r.x() - 1, r.y() - 1 );
paintContents( &p );
}
const TQPixmap &KJanusWidget::IconListItem::defaultPixmap()
{
static TQPixmap *pix=0;
@ -1043,16 +1124,35 @@ const TQPixmap &KJanusWidget::IconListItem::defaultPixmap()
void KJanusWidget::IconListItem::paint( TQPainter *painter )
{
TQRect itemPaintRegion( listBox()->itemRect( this ) );
TQRect r( 1, 1, itemPaintRegion.width() - 2, itemPaintRegion.height() - 2);
if ( isSelected() )
{
painter->eraseRect( r );
painter->save();
painter->setPen( listBox()->colorGroup().highlight().dark( 160 ) );
painter->drawRect( r );
painter->restore();
}
paintContents( painter );
}
void KJanusWidget::IconListItem::paintContents( TQPainter *painter )
{
TQFontMetrics fm = painter->fontMetrics();
int ht = fm.boundingRect( 0, 0, 0, 0, Qt::AlignCenter, text() ).height();
int wp = mPixmap.width();
int hp = mPixmap.height();
painter->drawPixmap( (mMinimumWidth - wp) / 2, 5, mPixmap );
if( !text().isEmpty() )
{
painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() );
painter->drawText( 1, hp + 7, mMinimumWidth - 2, ht, Qt::AlignCenter, text() );
}
}
@ -1082,6 +1182,7 @@ int KJanusWidget::IconListItem::width( const TQListBox *lb ) const
void KJanusWidget::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
// TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to
// delete the node.
void KJanusWidget::removePage( TQWidget *page )
@ -1129,6 +1230,7 @@ void KJanusWidget::removePage( TQWidget *page )
}
}
TQString KJanusWidget::pageTitle(int index) const
{
if (!d || !d->mIntToTitle.contains(index))
@ -1137,6 +1239,7 @@ TQString KJanusWidget::pageTitle(int index) const
return d->mIntToTitle[index];
}
TQWidget *KJanusWidget::pageWidget(int index) const
{
if (!d || !d->mIntToPage.contains(index))

@ -71,6 +71,8 @@ class KDEUI_EXPORT KJanusWidget : public QWidget
private:
class IconListBox : public KListBox
{
friend class KJanusWidget;
public:
IconListBox( TQWidget *parent=0, const char *name=0, WFlags f=0 );
void updateMinimumHeight();
@ -79,10 +81,15 @@ class KDEUI_EXPORT KJanusWidget : public QWidget
void invalidateWidth();
void setShowAll( bool showAll );
protected:
void slotOnItem( TQListBoxItem *item );
virtual void leaveEvent( TQEvent * );
private:
bool mShowAll;
bool mHeightValid;
bool mWidthValid;
TQListBoxItem *mOldItem;
};
public:
@ -558,6 +565,8 @@ class KDEUI_EXPORT KJanusWidget : public QWidget
private slots:
bool slotShowPage();
void slotFontChanged();
void slotOnItem(TQListBoxItem *item);
void slotItemClicked(TQListViewItem *it);
void pageGone(TQObject *obj); // signal from the added page's "destroyed" signal
void slotReopen(TQListViewItem *item);

@ -49,6 +49,8 @@
#include "kpassdlg.h"
#include "../kdesu/defaults.h"
/*
* Password line editor.
*/
@ -337,7 +339,8 @@ void KPasswordDialog::init()
KConfig* const cfg = KGlobal::config();
const KConfigGroupSaver saver(cfg, "Passwords");
if (m_Keep && cfg->readBoolEntry("Keep", false))
bool def = ( qstrcmp( qAppName(), "kdesu" ) == 0 ? defKeep : false );
if (m_Keep && cfg->readBoolEntry("Keep", def))
++m_Keep;
m_pMain = new TQWidget(this);

@ -187,7 +187,7 @@ KSpellConfig::readGlobalSettings()
setRunTogether ( kc->readNumEntry("KSpell_RunTogether", 0) );
setDictionary ( kc->readEntry("KSpell_Dictionary") );
setDictFromList ( kc->readNumEntry("KSpell_DictFromList", false) );
setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_ASCII) );
setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_UTF8) );
setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );
return true;

@ -551,7 +551,7 @@ TQString KDictSpellingHighlighter::spellKey()
key += '/';
key += TQString::number( config->readNumEntry( "KSpell_DictFromList", false ));
key += '/';
key += TQString::number( config->readNumEntry( "KSpell_Encoding", KS_E_ASCII ));
key += TQString::number( config->readNumEntry( "KSpell_Encoding", KS_E_UTF8 ));
key += '/';
key += TQString::number( config->readNumEntry( "KSpell_Client", KS_CLIENT_ISPELL ));
return key;

@ -367,24 +367,47 @@ void KTipDialog::showMultiTip(TQWidget *parent, const TQStringList &tipFiles, bo
mInstance->raise();
}
static TQString fixTip(TQString tip)
{
TQRegExp iconRegExp("<img src=\"(.*)\">");
iconRegExp.setMinimal(true);
if (iconRegExp.search(tip)>-1) {
TQString iconName = iconRegExp.cap(1);
if (!iconName.isEmpty())
if (KGlobal::dirs()->findResource("icon", iconName).isEmpty())
tip.replace("crystalsvg","hicolor");
}
return tip;
}
void KTipDialog::prevTip()
{
mDatabase->prevTip();
mTipText->setText(TQString::fromLatin1(
TQString currentTip = TQString::fromLatin1(
"<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
.arg(mTextColor.name())
.arg(mBaseColor.name())
.arg(i18n(mDatabase->tip().utf8())));
.arg(i18n(mDatabase->tip().utf8()));
currentTip = fixTip(currentTip);
mTipText->setText(currentTip);
mTipText->setContentsPos(0, 0);
}
void KTipDialog::nextTip()
{
mDatabase->nextTip();
mTipText->setText(TQString::fromLatin1("<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
TQString currentTip = TQString::fromLatin1(
"<qt text=\"%1\" bgcolor=\"%2\">%3</qt>")
.arg(mTextColor.name())
.arg(mBaseColor.name())
.arg(i18n(mDatabase->tip().utf8())));
.arg(i18n(mDatabase->tip().utf8()));
currentTip = fixTip(currentTip);
mTipText->setText(currentTip);
mTipText->setContentsPos(0, 0);
}

@ -314,8 +314,8 @@ bool QXEmbedAppFilter::eventFilter( TQObject *o, TQEvent * e)
if ( qApp->focusWidget() == o &&
((QPublicWidget*)qApp->focusWidget()->topLevelWidget())->topData()->embedded ) {
TQFocusEvent* fe = (TQFocusEvent*) e;
if ( obeyFocus || fe->reason() == TQFocusEvent::Mouse ||
fe->reason() == TQFocusEvent::Shortcut ) {
if ( obeyFocus || fe->reason() != TQFocusEvent::ActiveWindow /*|| fe->reason() == TQFocusEvent::Mouse ||
fe->reason() == TQFocusEvent::Shortcut*/ ) {
// L0614: A widget in the embedded client was just given the Qt focus.
// Variable `obeyFocus' suggests that this is the result of mouse
// activity in the client. The XEMBED_REQUEST_FOCUS message causes
@ -478,8 +478,11 @@ static int qxembed_x11_event_filter( XEvent* e)
switch ( detail ) {
case XEMBED_FOCUS_CURRENT:
// L0683: Set focus on saved focus widget
if ( focusCurrent )
if ( focusCurrent ) {
focusCurrent->setFocus();
if( QXEmbed* emb = dynamic_cast< QXEmbed* >( focusCurrent ))
emb->updateEmbeddedFocus( true );
}
else if ( !w->topLevelWidget()->focusWidget() )
w->topLevelWidget()->setFocus();
break;
@ -511,6 +514,8 @@ static int qxembed_x11_event_filter( XEvent* e)
// We first record what the focus widget was
// and clear the Qt focus.
if ( w->topLevelWidget()->focusWidget() ) {
if( QXEmbed* emb = dynamic_cast< QXEmbed* >( w->topLevelWidget()->focusWidget()))
emb->updateEmbeddedFocus( false );
focusMap->insert( w->topLevelWidget(),
new TQGuardedPtr<TQWidget>(w->topLevelWidget()->focusWidget() ) );
w->topLevelWidget()->focusWidget()->clearFocus();
@ -919,6 +924,17 @@ void QXEmbed::focusOutEvent( TQFocusEvent * ){
}
// When QXEmbed has TQt focus and gets/loses X focus, make sure the client knows
// about the state of the focus.
void QXEmbed::updateEmbeddedFocus( bool hasfocus ){
if (!window || d->xplain)
return;
if( hasfocus )
sendXEmbedMessage( window, XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT);
else
sendXEmbedMessage( window, XEMBED_FOCUS_OUT);
}
// L1600: Helper for QXEmbed::embed()
// Check whether a window is in withdrawn state.
static bool wstate_withdrawn( WId winid )
@ -1161,6 +1177,8 @@ bool QXEmbed::x11Event( XEvent* e)
// L2085: The client asks for the focus.
case XEMBED_REQUEST_FOCUS:
if( ((QPublicWidget*)topLevelWidget())->topData()->embedded ) {
focusMap->remove( topLevelWidget() );
focusMap->insert( topLevelWidget(), new TQGuardedPtr<TQWidget>( this ));
WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId;
sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
} else {

@ -191,6 +191,11 @@ public:
void enterWhatsThisMode(); // temporary, fix in Qt (Matthias, Mon Jul 17 15:20:55 CEST 2000 )
virtual void reparent( TQWidget * parent, WFlags f, const TQPoint & p, bool showIt = false );
/**
* @internal
*/
void updateEmbeddedFocus( bool hasfocus );
signals:
/**
* This signal is emitted when the embedded window has been lost (destroyed or reparented away)

@ -42,7 +42,7 @@ TQString HelpProtocol::langLookup(const TQString& fname)
TQStringList search;
// assemble the local search paths
const TQStringList localDoc = KGlobal::dirs()->resourceDirs("html");
const TQStringList localDoc = KGlobal::dirs()->resourceDirs("html") + KGlobal::dirs()->resourceDirs("html-bundle");
TQStringList langs = KGlobal::locale()->languageList();
langs.append( "en" );

@ -342,17 +342,17 @@ void XMLHttpRequest::send(const TQString& _body)
{
aborted = false;
if (method == "post") {
TQString protocol = url.protocol().lower();
// Abondon the request when the protocol is other than "http",
// instead of blindly changing it to a "get" request.
const TQString protocol = url.protocol().lower();
// Abandon the request when the protocol is other than "http",
// instead of blindly doing a KIO::get on other protocols like file:/.
if (!protocol.startsWith("http") && !protocol.startsWith("webdav"))
{
abort();
return;
}
if (method == "post") {
// FIXME: determine post encoding correctly by looking in headers
// for charset.
TQByteArray buf;

@ -151,6 +151,9 @@ public:
KHTMLViewPrivate()
: underMouse( 0 ), underMouseNonShared( 0 ), visibleWidgets( 107 )
#ifndef NO_SMOOTH_SCROLL_HACK
, dx(0), dy(0), ddx(0), ddy(0), rdx(0), rdy(0), scrolling(false)
#endif
{
#ifndef KHTML_NO_CARET
m_caretViewContext = 0;
@ -396,6 +399,17 @@ public:
short m_mouseScroll_byY;
TQTimer *m_mouseScrollTimer;
TQWidget *m_mouseScrollIndicator;
#ifndef NO_SMOOTH_SCROLL_HACK
TQTimer timer2;
int dx;
int dy;
// Step size * 16 and residual to avoid huge difference between 1px/step and 2px/step
int ddx;
int ddy;
int rdx;
int rdy;
bool scrolling;
#endif
};
#ifndef QT_NO_TOOLTIP
@ -504,6 +518,11 @@ KHTMLView::KHTMLView( KHTMLPart *part, TQWidget *parent, const char *name)
init();
viewport()->show();
#ifndef NO_SMOOTH_SCROLL_HACK
#define timer timer2
connect(&d->timer, TQT_SIGNAL(timeout()), this, TQT_SLOT(scrollTick()));
#undef timer
#endif
}
KHTMLView::~KHTMLView()
@ -1544,7 +1563,7 @@ void KHTMLView::keyPressEvent( TQKeyEvent *_ke )
case Key_Down:
case Key_J:
if (!d->scrollTimerId || d->scrollSuspended)
scrollBy( 0, 10 );
scrollBy( 0, 10 * _ke->count() );
if (d->scrollTimerId)
d->newScrollTimer(this, 0);
break;
@ -1559,7 +1578,7 @@ void KHTMLView::keyPressEvent( TQKeyEvent *_ke )
case Key_Up:
case Key_K:
if (!d->scrollTimerId || d->scrollSuspended)
scrollBy( 0, -10 );
scrollBy( 0, -10 * _ke->count());
if (d->scrollTimerId)
d->newScrollTimer(this, 0);
break;
@ -1572,14 +1591,14 @@ void KHTMLView::keyPressEvent( TQKeyEvent *_ke )
case Key_Right:
case Key_L:
if (!d->scrollTimerId || d->scrollSuspended)
scrollBy( 10, 0 );
scrollBy( 10 * _ke->count(), 0 );
if (d->scrollTimerId)
d->newScrollTimer(this, 0);
break;
case Key_Left:
case Key_H:
if (!d->scrollTimerId || d->scrollSuspended)
scrollBy( -10, 0 );
scrollBy( -10 * _ke->count(), 0 );
if (d->scrollTimerId)
d->newScrollTimer(this, 0);
break;
@ -1712,8 +1731,16 @@ void KHTMLView::keyReleaseEvent(TQKeyEvent *_ke)
d->scrollSuspendPreActivate = false;
if( _ke->key() == Key_Shift && d->scrollSuspendPreActivate && _ke->state() == Qt::ShiftButton
&& !(KApplication::keyboardMouseState() & Qt::ShiftButton))
{
if (d->scrollTimerId)
{
d->scrollSuspended = !d->scrollSuspended;
#ifndef NO_SMOOTH_SCROLL_HACK
if( d->scrollSuspended )
stopScrolling();
#endif
}
}
if (d->accessKeysEnabled)
{
@ -3061,6 +3088,16 @@ void KHTMLView::addFormCompletionItem(const TQString &name, const TQString &valu
d->formCompletions->writeEntry(name, items);
}
void KHTMLView::removeFormCompletionItem(const TQString &name, const TQString &value)
{
if (!m_part->settings()->isFormCompletionEnabled())
return;
TQStringList items = formCompletionItems(name);
if (items.remove(value))
d->formCompletions->writeEntry(name, items);
}
void KHTMLView::addNonPasswordStorableSite(const TQString& host)
{
if (!d->formCompletions) {
@ -3259,7 +3296,11 @@ void KHTMLView::viewportWheelEvent(TQWheelEvent* e)
else
{
d->scrollBarMoved = true;
#ifndef NO_SMOOTH_SCROLL_HACK
scrollViewWheelEvent( e );
#else
TQScrollView::viewportWheelEvent( e );
#endif
TQMouseEvent *tempEvent = new TQMouseEvent( TQEvent::MouseMove, TQPoint(-1,-1), TQPoint(-1,-1), Qt::NoButton, e->state() );
emit viewportMouseMoveEvent ( tempEvent );
@ -4462,4 +4503,117 @@ void KHTMLView::moveCaretToLineEnd()
#endif // KHTML_NO_CARET
#ifndef NO_SMOOTH_SCROLL_HACK
#define timer timer2
// All scrolls must be completed within 240ms of last keypress
static const int SCROLL_TIME = 240;
// Each step is 20 ms == 50 frames/second
static const int SCROLL_TICK = 20;
void KHTMLView::scrollBy(int dx, int dy)
{
KConfigGroup cfg( KGlobal::config(), "KDE" );
if( !cfg.readBoolEntry( "SmoothScrolling", true )) {
TQScrollView::scrollBy( dx, dy );
return;
}
// scrolling destination
int full_dx = d->dx + dx;
int full_dy = d->dy + dy;
// scrolling speed
int ddx = 0;
int ddy = 0;
int steps = SCROLL_TIME/SCROLL_TICK;
ddx = (full_dx*16)/steps;
ddy = (full_dy*16)/steps;
// don't go under 1px/step
if (ddx > 0 && ddx < 16) ddx = 16;
if (ddy > 0 && ddy < 16) ddy = 16;
if (ddx < 0 && ddx > -16) ddx = -16;
if (ddy < 0 && ddy > -16) ddy = -16;
d->dx = full_dx;
d->dy = full_dy;
d->ddx = ddx;
d->ddy = ddy;
if (!d->scrolling) {
scrollTick();
startScrolling();
}
}
void KHTMLView::scrollTick() {
if (d->dx == 0 && d->dy == 0) {
stopScrolling();
return;
}
int tddx = d->ddx + d->rdx;
int tddy = d->ddy + d->rdy;
int ddx = tddx / 16;
int ddy = tddy / 16;
d->rdx = tddx % 16;
d->rdy = tddy % 16;
if (d->dx > 0 && ddx > d->dx) ddx = d->dx;
else
if (d->dx < 0 && ddx < d->dx) ddx = d->dx;
if (d->dy > 0 && ddy > d->dy) ddy = d->dy;
else
if (d->dy < 0 && ddy < d->dy) ddy = d->dy;
d->dx -= ddx;
d->dy -= ddy;
// TQScrollView::setContentsPos( contentsX() + ddx, contentsY() + ddy);
kapp->syncX();
TQScrollView::scrollBy(ddx, ddy);
// Unaccelerated X can get seriously overloaded by scrolling and for some reason
// will send KeyPress events only infrequently. This should help to reduce
// the load.
kapp->syncX();
}
void KHTMLView::startScrolling()
{
d->scrolling = true;
d->timer.start(SCROLL_TICK, false);
}
void KHTMLView::stopScrolling()
{
d->timer.stop();
d->dx = d->dy = 0;
d->scrolling = false;
}
// Overloaded from TQScrollView and TQScrollBar
void KHTMLView::scrollViewWheelEvent( TQWheelEvent *e )
{
int pageStep = verticalScrollBar()->pageStep();
int lineStep = verticalScrollBar()->lineStep();
int step = QMIN( TQApplication::wheelScrollLines()*lineStep, pageStep );
if ( ( e->state() & ControlButton ) || ( e->state() & ShiftButton ) )
step = pageStep;
if(e->orientation() == Horizontal)
scrollBy(-((e->delta()*step)/120), 0);
else if(e->orientation() == Vertical)
scrollBy(0,-((e->delta()*step)/120));
e->accept();
}
#undef timer
#endif // NO_SMOOTH_SCROLL_HACK
#undef DEBUG_CARETMODE

@ -181,6 +181,11 @@ signals:
void hideAccessKeys();
void repaintAccessKeys();
void findAheadActive( bool );
//#define NO_SMOOTH_SCROLL_HACK
#ifndef NO_SMOOTH_SCROLL_HACK
public slots:
void scrollBy(int dx, int dy);
#endif
protected:
void clear();
@ -211,9 +216,23 @@ protected:
void contentsContextMenuEvent ( TQContextMenuEvent *_ce );
void doAutoScroll();
void timerEvent ( TQTimerEvent * );
#ifndef NO_SMOOTH_SCROLL_HACK
void startScrolling();
void stopScrolling();
#ifndef QT_NO_WHEELEVENT
void scrollViewWheelEvent( TQWheelEvent* e );
#endif
#endif
protected slots:
void slotPaletteChanged();
void slotScrollBarMoved();
#ifndef NO_SMOOTH_SCROLL_HACK
void scrollTick();
#else
void scrollTick() {}; // moc cannot handle #if
#endif
private slots:
void tripleClickTimeout();
@ -295,6 +314,7 @@ private:
TQStringList formCompletionItems(const TQString &name) const;
void clearCompletionHistory(const TQString& name);
void addFormCompletionItem(const TQString &name, const TQString &value);
void removeFormCompletionItem(const TQString &name, const TQString &value);
void addNonPasswordStorableSite( const TQString& host );
bool nonPasswordStorableSite( const TQString& host ) const;

@ -385,7 +385,9 @@ TQPopupMenu *LineEditWidget::createPopupMenu()
if (m_input->autoComplete()) {
popup->insertSeparator();
int id = popup->insertItem( SmallIconSet("history_clear"), i18n("Clear &History"), ClearHistory );
int id = popup->insertItem( SmallIconSet("edit"), i18n("&Edit History..."), EditHistory );
popup->setItemEnabled( id, (compObj() && !compObj()->isEmpty()) );
id = popup->insertItem( SmallIconSet("history_clear"), i18n("Clear &History"), ClearHistory );
popup->setItemEnabled( id, (compObj() && !compObj()->isEmpty()) );
}
@ -409,11 +411,25 @@ void LineEditWidget::extendedMenuActivated( int id)
m_view->clearCompletionHistory(m_input->name().string());
if (compObj())
compObj()->clear();
case EditHistory:
{
KHistoryComboEditor dlg( compObj() ? compObj()->items() : TQStringList(), this );
connect( &dlg, TQT_SIGNAL( removeFromHistory(const TQString&) ), TQT_SLOT( slotRemoveFromHistory(const TQString&)) );
dlg.exec();
}
default:
break;
}
}
void LineEditWidget::slotRemoveFromHistory(const TQString &entry)
{
m_view->removeFormCompletionItem(m_input->name().string(), entry);
if (compObj())
compObj()->removeItem(entry);
}
bool LineEditWidget::event( TQEvent *e )
{
if (KLineEdit::event(e))

@ -272,10 +272,12 @@ private slots:
void spellCheckerMisspelling( const TQString &text, const TQStringList &, unsigned int pos);
void spellCheckerCorrected( const TQString &, const TQString &, unsigned int );
void spellCheckerFinished();
void slotRemoveFromHistory( const TQString & );
private:
enum LineEditMenuID {
ClearHistory
ClearHistory,
EditHistory
};
DOM::HTMLInputElementImpl* m_input;
KHTMLView* m_view;

@ -114,7 +114,9 @@ static bool startCondition(const TQString &condition)
void
AutoStart::loadAutoStartList()
{
TQStringList files = KGlobal::dirs()->findAllResources("autostart", "*.desktop", false, true);
TQStringList files = KGlobal::dirs()->findAllResources("xdgconf-autostart", "*.desktop", false, true);
TQStringList kdefiles = KGlobal::dirs()->findAllResources("autostart", "*.desktop", false, true);
files += kdefiles;
for(TQStringList::ConstIterator it = files.begin();
it != files.end();
@ -139,6 +141,17 @@ AutoStart::loadAutoStartList()
continue;
}
if (config.hasKey("OnlyShowIn"))
{
if (!config.readListEntry("OnlyShowIn", ';').contains("KDE"))
continue;
}
if (config.hasKey("NotShowIn"))
{
if (config.readListEntry("NotShowIn", ';').contains("KDE"))
continue;
}
AutoStartItem *item = new AutoStartItem;
item->name = extractName(*it);
item->service = *it;

@ -39,7 +39,7 @@
int check_tmp_dir(const char *tmp_dir);
int create_link(const char *file, const char *tmp_dir);
int build_link(const char *tmp_prefix, const char *kde_prefix);
int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname);
int check_tmp_dir(const char *tmp_dir)
{
@ -92,7 +92,7 @@ int create_link(const char *file, const char *tmp_dir)
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
int build_link(const char *tmp_prefix, const char *kde_prefix)
int build_link(const char *tmp_prefix, const char *kde_prefix, int kdehostname)
{
struct passwd *pw_ent;
char kde_tmp_dir[PATH_MAX+1];
@ -160,10 +160,21 @@ int build_link(const char *tmp_prefix, const char *kde_prefix)
}
strncat(kde_tmp_dir, kde_prefix, PATH_MAX - strlen(kde_tmp_dir));
if( kdehostname )
{
if( getenv("XAUTHLOCALHOSTNAME"))
strncat(kde_tmp_dir+strlen(kde_tmp_dir), getenv("XAUTHLOCALHOSTNAME"), PATH_MAX - strlen(kde_tmp_dir) - 1);
else
return 0;
}
else
{
if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
{
perror("Aborting. Could not determine hostname: ");
exit(255);
perror("Could not determine hostname: ");
return 1;
}
}
kde_tmp_dir[sizeof(kde_tmp_dir)-1] = '\0';
@ -269,7 +280,9 @@ int main(int argc, char **argv)
kde_prefix = "/cache-";
}
res = build_link(tmp_prefix, kde_prefix);
res = build_link(tmp_prefix, kde_prefix, 1);
if( build_link(tmp_prefix, kde_prefix, 0))
res = 1;
free(tmp_prefix);

@ -164,7 +164,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;

@ -1165,6 +1165,12 @@ void KFileDialog::urlEntered(const KURL& url)
d->pathCombo->setURL( url );
}
if (url.protocol()=="beagle" && url.path()=="/") {
d->pathCombo->setEditText("beagle:/<"+i18n("search term")+">");
d->pathCombo->lineEdit()->setSelection(8,255);
d->pathCombo->setFocus();
}
locationEdit->blockSignals( true );
locationEdit->setCurrentItem( 0 );
if ( d->keepLocation )

@ -24,6 +24,7 @@
#include <tqradiobutton.h>
#include <tqbuttongroup.h>
#include <tqlayout.h>
#include <tqlineedit.h>
#include <kprocess.h>
#include <kprocio.h>
#include <klocale.h>
@ -47,6 +48,7 @@ public:
KProcess *m_configProc;
bool m_bAllShared;
bool m_bAllUnshared;
bool m_bAllReadOnly;
};
KFileSharePropsPlugin::KFileSharePropsPlugin( KPropertiesDialog *_props )
@ -98,8 +100,10 @@ void KFileSharePropsPlugin::init()
delete m_widget;
m_rbShare = 0L;
m_rbUnShare = 0L;
m_rbSharerw = 0L;
m_widget = new TQWidget( d->m_vBox );
TQVBoxLayout * vbox = new TQVBoxLayout( m_widget );
//TQHBoxLayout * hbox = new TQHBoxLayout( vbox );
switch ( KFileShare::authorization() ) {
case KFileShare::Authorized:
@ -110,18 +114,29 @@ void KFileSharePropsPlugin::init()
home += '/';
bool ok = true;
KFileItemList items = properties->items();
// We have 3 possibilities: all shared, all unshared, or mixed.
// We have 3 possibilities: all shared, all unshared (ro,rw), or mixed.
d->m_bAllShared = true;
d->m_bAllUnshared = true;
d->m_bAllReadOnly = true;
KFileItemListIterator it( items );
for ( ; it.current() && ok; ++it ) {
TQString path = (*it)->url().path();
// 0 => not shared
// 1 => shared read only
// 3 => shared writeable
int dirStatus = KFileShare::isDirectoryShared( path );
if ( !path.startsWith( home ) )
ok = false;
if ( KFileShare::isDirectoryShared( path ) )
if ( dirStatus == 1 ) {
d->m_bAllUnshared = false;
else
d->m_bAllShared = false;
}
else if ( dirStatus == 3 ) {
d->m_bAllUnshared = false;
d->m_bAllReadOnly = false;
}
else {
d->m_bAllReadOnly = false;
}
}
if ( !ok )
{
@ -141,16 +156,31 @@ void KFileSharePropsPlugin::init()
vbox->addWidget( m_rbUnShare, 0 );
rbGroup->insert( m_rbUnShare );
m_rbShare = new TQRadioButton( i18n("Shared"), m_widget );
m_rbShare = new TQRadioButton( i18n("Shared - read only for others"), m_widget );
connect( m_rbShare, TQT_SIGNAL( toggled(bool) ), TQT_SIGNAL( changed() ) );
vbox->addWidget( m_rbShare, 0 );
rbGroup->insert( m_rbShare );
m_rbSharerw = new TQRadioButton( i18n("Shared - writeable for others"), m_widget );
connect( m_rbSharerw, TQT_SIGNAL( toggled(bool) ), TQT_SIGNAL( changed() ) );
vbox->addWidget( m_rbSharerw, 0 );
rbGroup->insert( m_rbSharerw );
//TQLabel *testlabel1 = new TQLabel(i18n("Enter Samba Share Name here"),m_widget);
//m_leSmbShareName = new TQLineEdit(m_widget);
//m_leSmbShareName->setMaxLength(12);
//hbox->addWidget( testlabel1, 0 );
//hbox->addWidget( m_leSmbShareName );
//vbox->addLayout( hbox );
// Activate depending on status
if ( d->m_bAllShared )
m_rbShare->setChecked(true);
m_rbSharerw->setChecked(true);
if ( d->m_bAllUnshared )
m_rbUnShare->setChecked(true);
if ( d->m_bAllReadOnly )
m_rbShare->setChecked(true);
// Some help text
TQLabel *label = new TQLabel( i18n("Sharing this folder makes it available under Linux/UNIX (NFS) and Windows (Samba).") , m_widget );
@ -167,6 +197,9 @@ void KFileSharePropsPlugin::init()
vbox->addWidget( m_pbConfig, 0, Qt::AlignHCenter );
vbox->addStretch( 10 );
if( !KFileShare::sambaActive() && !KFileShare::nfsActive())
m_widget->setEnabled( false );
}
}
break;
@ -228,7 +261,7 @@ void KFileSharePropsPlugin::slotConfigureFileSharingDone()
void KFileSharePropsPlugin::applyChanges()
{
kdDebug() << "KFileSharePropsPlugin::applyChanges" << endl;
if ( m_rbShare && m_rbUnShare )
if ( m_rbShare && m_rbUnShare && m_rbSharerw )
{
bool share = m_rbShare->isChecked();
@ -242,7 +275,7 @@ void KFileSharePropsPlugin::applyChanges()
bool ok = true;
for ( ; it.current() && ok; ++it ) {
TQString path = (*it)->url().path();
ok = setShared( path, share );
ok = SuSEsetShared( path, share, m_rbSharerw->isChecked() );
if (!ok) {
if (share)
KMessageBox::detailedError(properties,
@ -269,8 +302,14 @@ void KFileSharePropsPlugin::applyChanges()
bool KFileSharePropsPlugin::setShared( const TQString& path, bool shared )
{
kdDebug() << "KFileSharePropsPlugin::setShared " << path << "," << shared << endl;
return KFileShare::setShared( path, shared );
return SuSEsetShared( path, shared, true );
}
bool KFileSharePropsPlugin::SuSEsetShared( const TQString& path, bool shared, bool readonly )
{
kdDebug() << "KFileSharePropsPlugin::setShared " << path << ","
<< shared << readonly << endl;
return KFileShare::SuSEsetShared( path, shared, readonly );
}
TQWidget* KFileSharePropsPlugin::page() const

@ -55,10 +55,13 @@ protected slots:
private:
void init();
bool setShared( const TQString&path, bool shared );
bool SuSEsetShared( const TQString&path, bool shared, bool readonly );
TQWidget *m_widget;
TQRadioButton *m_rbShare;
TQRadioButton *m_rbSharerw;
TQRadioButton *m_rbUnShare;
//TQLineEdit *m_leSmbShareName;
TQPushButton *m_pbConfig;
class Private;
Private *d;

@ -605,8 +605,19 @@ void KURLBar::readItem( int i, KConfig *config, bool applicationLocal )
if ( !url.isValid() || !KProtocolInfo::isKnownProtocol( url ))
return; // nothing we could do.
TQString description = config->readEntry( TQString("Description_") + number );
if (description.isEmpty() && url.protocol()=="beagle") {
KIO::UDSEntry uds;
const KURL kurl("beagle:?beagled-status");
if (!KIO::NetAccess::stat(kurl, uds))
return;
description = i18n("Desktop Search");
}
insertItem( url,
config->readEntry( TQString("Description_") + number ),
description,
applicationLocal,
config->readEntry( TQString("Icon_") + number ),
static_cast<KIcon::Group>(

@ -725,7 +725,8 @@ bool KDirWatchPrivate::useINotify( Entry* e )
bool KDirWatchPrivate::useStat(Entry* e)
{
if (KIO::probably_slow_mounted(e->path))
if ( e->path.startsWith("/media/") || (e->path == "/media")
|| (KIO::probably_slow_mounted(e->path)) )
useFreq(e, m_nfsPollInterval);
else
useFreq(e, m_PollInterval);

@ -20,6 +20,7 @@
#include "kfileshare.h"
#include <tqdir.h>
#include <tqfile.h>
#include <tqregexp.h>
#include <kprocess.h>
#include <kprocio.h>
#include <klocale.h>
@ -35,8 +36,10 @@
#include <kuser.h>
KFileShare::Authorization KFileShare::s_authorization = NotInitialized;
TQStringList* KFileShare::s_shareList = 0L;
static KStaticDeleter<TQStringList> sdShareList;
//TQStringList* KFileShare::s_shareList = 0L;
//static KStaticDeleter<TQStringList> sdShareList;
TQMap<TQString,TQString>* KFileShare::s_shareMap = 0L;
static KStaticDeleter<TQMap<TQString,TQString> > sdShareMap;
KFileShare::ShareMode KFileShare::s_shareMode;
bool KFileShare::s_sambaEnabled;
@ -165,10 +168,10 @@ bool KFileShare::nfsEnabled() {
void KFileShare::readShareList()
{
KFileSharePrivate::self();
if ( !s_shareList )
sdShareList.setObject( s_shareList, new TQStringList );
if ( !s_shareMap )
sdShareMap.setObject( s_shareMap, new TQMap<TQString,TQString> );
else
s_shareList->clear();
s_shareMap->clear();
// /usr/sbin on Mandrake, $PATH allows flexibility for other distributions
TQString exe = findExe( "filesharelist" );
@ -186,29 +189,45 @@ void KFileShare::readShareList()
// Reading code shamelessly stolen from khostname.cpp ;)
TQString line;
TQString options;
TQString path;
int length;
TQRegExp rx_line("([^\\s]+)\\s+(.*)");
do {
length = proc.readln(line, true);
if ( length > 0 )
{
if ( line[length-1] != '/' )
line += '/';
s_shareList->append(line);
if( rx_line.search( line ) != -1 ) {
options = rx_line.cap(1);
path = rx_line.cap(2);
(*s_shareMap)[path] = options;
}
kdDebug(7000) << "Shared dir:" << line << endl;
}
} while (length > -1);
}
bool KFileShare::isDirectoryShared( const TQString& _path )
int KFileShare::isDirectoryShared( const TQString& _path )
{
if ( ! s_shareList )
int ret(0);
if ( ! s_shareMap )
readShareList();
TQString path( _path );
if ( path[path.length()-1] != '/' )
path += '/';
return s_shareList && s_shareList->contains( path );
//return s_shareList && s_shareList->contains( path );
if( (*s_shareMap).contains(path) && !((*s_shareMap)[path].isEmpty()) ) {
ret+=1;
if( (*s_shareMap)[path].find("readwrite") != -1 )
ret+=2;
}
return ret;
}
KFileShare::Authorization KFileShare::authorization()
@ -230,18 +249,31 @@ TQString KFileShare::findExe( const char* exeName )
}
bool KFileShare::setShared( const TQString& path, bool shared )
{
return SuSEsetShared( path, shared, false );
}
bool KFileShare::SuSEsetShared( const TQString& path, bool shared, bool rw )
{
if (! KFileShare::sharingEnabled() ||
KFileShare::shareMode() == Advanced)
return false;
kdDebug(7000) << "KFileShare::setShared " << path << "," << shared << endl;
TQString exe = KFileShare::findExe( "fileshareset" );
if (exe.isEmpty())
return false;
// we want to share, so we kick it first - just to be sure
KProcess proc;
proc << exe;
proc << "--remove";
proc << path;
proc.start( KProcess::Block );
proc.clearArguments();
proc << exe;
if( rw )
proc << "--rw";
if ( shared )
proc << "--add";
else
@ -291,4 +323,24 @@ bool KFileShare::setShared( const TQString& path, bool shared )
return ok;
}
bool KFileShare::sambaActive()
{
// rcsmb is not executable by users, try ourselves
int status = system( "/sbin/checkproc -p /var/run/samba/smbd.pid /usr/sbin/smbd" );
return status != -1 && WIFEXITED( status ) && WEXITSTATUS( status ) == 0;
}
bool KFileShare::nfsActive()
{
// rcnfsserver is not executable by users, try ourselves
int status = system( "/sbin/checkproc /usr/sbin/rpc.mountd" );
if( status != -1 && WIFEXITED( status ) && WEXITSTATUS( status ) == 0 )
{
status = system( "/sbin/checkproc -n nfsd" );
if( status != -1 && WIFEXITED( status ) && WEXITSTATUS( status ) == 0 )
return true;
}
return false;
}
#include "kfileshare.moc"

@ -67,7 +67,7 @@ public:
/**
* Call this to know if a directory is currently shared
*/
static bool isDirectoryShared( const TQString& path );
static int isDirectoryShared( const TQString& path );
enum Authorization { NotInitialized, ErrorNotFound, Authorized, UserNotAllowed };
/**
@ -86,6 +86,11 @@ public:
*/
static bool setShared( const TQString& path, bool shared );
/*
* SuSE only enhancement for now
*/
static bool SuSEsetShared( const TQString& path, bool shared, bool ro );
/**
* The used share mode.
* Simple means that the simple sharing dialog is used and
@ -132,9 +137,22 @@ public:
*/
static bool nfsEnabled();
/**
* Returns whether Samba is active (service is running)
* @internal
*/
static bool sambaActive();
/**
* Returns whether NFS is active (service is running)
* @internal
*/
static bool nfsActive();
private:
static Authorization s_authorization;
static TQStringList* s_shareList;
// static TQStringList* s_shareList;
static TQMap<TQString,TQString>* s_shareMap;
static ShareMode s_shareMode;
static bool s_sambaEnabled;
static bool s_nfsEnabled;

@ -677,9 +677,8 @@ TQString KFolderType::comment( const KURL& _url, bool _is_local ) const
KURL u( _url );
u.addPath( ".directory" );
KSimpleConfig cfg( u.path(), true );
cfg.setDesktopGroup();
TQString comment = cfg.readEntry( "Comment" );
KDesktopFile cfg( u.path(), true );
TQString comment = cfg.readComment();
if ( comment.isEmpty() )
return KMimeType::comment( _url, _is_local );
@ -772,9 +771,8 @@ TQString KDEDesktopMimeType::comment( const KURL& _url, bool _is_local ) const
if ( !_is_local )
return KMimeType::comment( _url, _is_local );
KSimpleConfig cfg( _url.path(), true );
cfg.setDesktopGroup();
TQString comment = cfg.readEntry( "Comment" );
KDesktopFile cfg( _url.path(), true );
TQString comment = cfg.readComment();
if ( comment.isEmpty() )
return KMimeType::comment( _url, _is_local );

@ -80,6 +80,8 @@ void KRemoteEncoding::setEncoding(const char *name)
if (name)
codec = TQTextCodec::codecForName(name);
else
codec = TQTextCodec::codecForMib( 106 ); // fallback to UTF-8
if (codec == 0L)
codec = TQTextCodec::codecForMib(1);

@ -115,7 +115,7 @@ KService::init( KDesktopFile *config )
return;
}
m_strName = config->readEntry( "Name" );
m_strName = config->readName();
entryMap.remove("Name");
if ( m_strName.isEmpty() )
{
@ -135,7 +135,7 @@ KService::init( KDesktopFile *config )
m_strName = m_strName.left(i);
}
m_strType = config->readEntry( "Type" );
m_strType = config->readType();
entryMap.remove("Type");
if ( m_strType.isEmpty() )
{
@ -224,11 +224,11 @@ KService::init( KDesktopFile *config )
entryMap.remove("Terminal");
m_strTerminalOptions = config->readEntry( "TerminalOptions" ); // should be a property IMHO
entryMap.remove("TerminalOptions");
m_strPath = config->readPathEntry( "Path" );
m_strPath = config->readPath();
entryMap.remove("Path");
m_strComment = config->readEntry( "Comment" );
m_strComment = config->readComment();
entryMap.remove("Comment");
m_strGenName = config->readEntry( "GenericName" );
m_strGenName = config->readGenericName();
if (kde4application) {
m_strGenName += " [KDE4]";
}
@ -275,6 +275,9 @@ KService::init( KDesktopFile *config )
m_bAllowAsDefault = config->readBoolEntry( "AllowDefault", true );
entryMap.remove("AllowDefault");
m_initialPreference = config->readNumEntry( "X-KDE-InitialPreference", 1 );
entryMap.remove("X-KDE-InitialPreference");
if ( m_initialPreference == 1 )
m_initialPreference = config->readNumEntry( "InitialPreference", 1 );
entryMap.remove("InitialPreference");

@ -64,13 +64,11 @@ KServiceGroup::KServiceGroup( const TQString &configFile, const TQString & _relp
d->directoryEntryPath = cfg;
KConfig config( cfg, true, false, "apps" );
KDesktopFile config( cfg, true, "apps" );
config.setDesktopGroup();
m_strCaption = config.readEntry( "Name" );
m_strIcon = config.readEntry( "Icon" );
m_strComment = config.readEntry( "Comment" );
m_strCaption = config.readName();
m_strIcon = config.readIcon();
m_strComment = config.readComment();
m_bDeleted = config.readBoolEntry( "Hidden", false );
d->m_bNoDisplay = config.readBoolEntry( "NoDisplay", false );
TQStringList tmpList;

@ -337,7 +337,7 @@ bool NetAccess::statInternal( const KURL & url, int details, bool source,
TQWidget* window )
{
bJobOK = true; // success unless further error occurs
KIO::StatJob * job = KIO::stat( url, !url.isLocalFile() );
KIO::StatJob * job = KIO::stat( url, !url.isLocalFile() && !url.url().startsWith("beagle:?") );
job->setWindow (window);
job->setDetails( details );
job->setSide( source );

@ -96,9 +96,14 @@ static int (*K_BIO_write) (BIO *b, const void *data, int len) = 0L;
static int (*K_PEM_ASN1_write_bio) (int (*)(),const char *,BIO *,char *,
const EVP_CIPHER *,unsigned char *,int ,
pem_password_cb *, void *) = 0L;
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
static int (*K_ASN1_item_i2d_fp)(ASN1_ITEM *,FILE *,unsigned char *) = 0L;
static ASN1_ITEM *K_NETSCAPE_X509_it = 0L;
#else
static ASN1_METHOD* (*K_X509_asn1_meth) (void) = 0L;
static int (*K_ASN1_i2d_fp)(int (*)(),FILE *,unsigned char *) = 0L;
static int (*K_i2d_ASN1_HEADER)(ASN1_HEADER *, unsigned char **) = 0L;
#endif
static int (*K_X509_print_fp) (FILE *, X509*) = 0L;
static int (*K_i2d_PKCS12) (PKCS12*, unsigned char**) = 0L;
static int (*K_i2d_PKCS12_fp) (FILE *, PKCS12*) = 0L;
@ -404,9 +409,14 @@ KConfig *cfg;
K_BIO_ctrl = (long (*) (BIO *,int,long,void *)) _cryptoLib->symbol("BIO_ctrl");
K_BIO_write = (int (*) (BIO *b, const void *data, int len)) _cryptoLib->symbol("BIO_write");
K_PEM_ASN1_write_bio = (int (*)(int (*)(), const char *,BIO*, char*, const EVP_CIPHER *, unsigned char *, int, pem_password_cb *, void *)) _cryptoLib->symbol("PEM_ASN1_write_bio");
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_item_i2d_fp");
K_NETSCAPE_X509_it = (ASN1_ITEM *) _cryptoLib->symbol("NETSCAPE_X509_it");
#else
K_X509_asn1_meth = (ASN1_METHOD* (*)(void)) _cryptoLib->symbol("X509_asn1_meth");
K_ASN1_i2d_fp = (int (*)(int (*)(), FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_i2d_fp");
K_i2d_ASN1_HEADER = (int (*)(ASN1_HEADER *, unsigned char **)) _cryptoLib->symbol("i2d_ASN1_HEADER");
#endif
K_X509_print_fp = (int (*)(FILE*, X509*)) _cryptoLib->symbol("X509_print_fp");
K_i2d_PKCS12 = (int (*)(PKCS12*, unsigned char**)) _cryptoLib->symbol("i2d_PKCS12");
K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) _cryptoLib->symbol("i2d_PKCS12_fp");
@ -568,7 +578,7 @@ KConfig *cfg;
K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) _sslLib->symbol("SSL_set_session");
K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,unsigned char**, long)) _sslLib->symbol("d2i_SSL_SESSION");
K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,unsigned char**)) _sslLib->symbol("i2d_SSL_SESSION");
K_SSL_get_ciphers = (STACK *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
K_SSL_get_ciphers = (STACK_OF(SSL_CIPHER) *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
#endif
@ -956,7 +966,13 @@ int KOpenSSLProxy::PEM_write_bio_X509(BIO *bp, X509 *x) {
else return -1;
}
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) {
if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it)
return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x);
else return -1;
}
#else
ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(void) {
if (K_X509_asn1_meth) return (K_X509_asn1_meth)();
else return 0L;
@ -968,7 +984,7 @@ int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) {
return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x);
else return -1;
}
#endif
int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) {
if (K_X509_print_fp) return (K_X509_print_fp)(fp, x);

@ -48,6 +48,9 @@ class KOpenSSLProxyPrivate;
#include <openssl/stack.h>
#include <openssl/bn.h>
#undef crypt
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
#define STACK _STACK
#endif
#endif
#include <kstaticdeleter.h>
@ -446,12 +449,12 @@ public:
*/
int PEM_write_bio_X509(BIO *bp, X509 *x);
#if OPENSSL_VERSION_NUMBER < 0x10000000L
/*
* X509_asn1_meth - used for netscape output
*/
ASN1_METHOD *X509_asn1_meth();
#endif
/*
* ASN1_i2d_fp - used for netscape output
@ -531,6 +534,9 @@ public:
*/
void sk_free(STACK *s);
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
void sk_free(void *s) { return sk_free(reinterpret_cast<STACK*>(s)); }
#endif
/*
* Number of elements in the stack
@ -543,6 +549,9 @@ public:
*/
char *sk_value(STACK *s, int n);
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
char *sk_value(void *s, int n) { return sk_value(reinterpret_cast<STACK*>(s), n); }
#endif
/*
* Create a new stack
@ -555,6 +564,9 @@ public:
*/
int sk_push(STACK *s, char *d);
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
int sk_push(void *s, void *d) { return sk_push(reinterpret_cast<STACK*>(s), reinterpret_cast<char*>(d)); }
#endif
/*
* Duplicate the stack

@ -87,7 +87,7 @@ KSMIMECryptoPrivate::KSMIMECryptoPrivate(KOpenSSLProxy *kossl): kossl(kossl) {
STACK_OF(X509) *KSMIMECryptoPrivate::certsToX509(TQPtrList<KSSLCertificate> &certs) {
STACK_OF(X509) *x509 = sk_new(NULL);
STACK_OF(X509) *x509 = reinterpret_cast<STACK_OF(X509)*>(sk_new(NULL));
KSSLCertificate *cert = certs.first();
while(cert) {
sk_X509_push(x509, cert->getCert());

@ -1003,10 +1003,23 @@ return qba;
TQByteArray KSSLCertificate::toNetscape() {
TQByteArray qba;
#ifdef KSSL_HAVE_SSL
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
NETSCAPE_X509 nx;
ASN1_OCTET_STRING hdr;
#else
ASN1_HEADER ah;
ASN1_OCTET_STRING os;
#endif
KTempFile ktf;
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
hdr.data = (unsigned char *)NETSCAPE_CERT_HDR;
hdr.length = strlen(NETSCAPE_CERT_HDR);
nx.header = &hdr;
nx.cert = getCert();
d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&nx);
#else
os.data = (unsigned char *)NETSCAPE_CERT_HDR;
os.length = strlen(NETSCAPE_CERT_HDR);
ah.header = &os;
@ -1014,6 +1027,7 @@ KTempFile ktf;
ah.meth = d->kossl->X509_asn1_meth();
d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&ah);
#endif
ktf.close();

@ -355,6 +355,44 @@ int KWalletD::doTransactionOpen(const TQCString& appid, const TQString& wallet,
return rc;
}
int KWalletD::tryOpen(const TQString& wallet, const TQCString& password)
{
if (isOpen(wallet))
return 0;
if (_tryOpenBlocked.isActive()) {
kdDebug() << "tryOpen is active.." << endl;
return -1;
}
if (!KWallet::Backend::exists(wallet))
return -2;
KWallet::Backend *b = new KWallet::Backend(wallet, false /*isPath*/);
int rc = b->open(TQByteArray().duplicate(password, strlen(password)));
if (rc == 0) {
_wallets.insert(rc = generateHandle(), b);
_passwords[wallet] = password;
b->ref();
_tryOpenBlocked.stop();
TQByteArray data;
TQDataStream ds(data, IO_WriteOnly);
ds << wallet;
emitDCOPSignal("walletOpened(TQString)", data);
}
else {
delete b;
// make sure that we're not bombed with a dictionary attack
_tryOpenBlocked.start (30 * 1000, true /*single shot*/);
if (++_failed > 5) {
_failed = 0;
TQTimer::singleShot(0, this, TQT_SLOT(notifyFailures()));
}
rc = -1;
}
return rc;
}
int KWalletD::internalOpen(const TQCString& appid, const TQString& wallet, bool isPath, WId w, bool modal) {
int rc = -1;

@ -26,6 +26,7 @@
#include <tqintdict.h>
#include <tqstring.h>
#include <tqwidget.h>
#include <tqtimer.h>
#include <tqguardedptr.h>
#include "kwalletbackend.h"
@ -51,8 +52,10 @@ class KWalletD : public KDEDModule {
// Open and unlock the wallet
virtual int open(const TQString& wallet, uint wId);
// Open and unlock the wallet
virtual int tryOpen(const TQString& wallet, const TQCString& passwd);
// Open and unlock the wallet with this path
virtual int openPath(const TQString& path, uint wId);
// Asynchronous open - must give the object to return the handle
@ -186,6 +189,7 @@ class KWalletD : public KDEDModule {
int _idleTime;
TQMap<TQString,TQStringList> _implicitAllowMap, _implicitDenyMap;
KTimeout *_timeouts;
TQTimer _tryOpenBlocked;
TQPtrList<KWalletTransaction> _transactions;
TQGuardedPtr< TQWidget > activeDialog;

@ -10,7 +10,7 @@ kde_module_LTLIBRARIES = kio_file.la
kio_file_la_SOURCES = file.cc
kio_file_la_LIBADD = $(LIB_KIO) $(LIB_QT) $(LIB_KDECORE) $(ACL_LIBS)
kio_file_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
kio_file_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(top_builddir)/dcop/libDCOP.la
noinst_HEADERS = file.h
fileinclude_HEADERS = file.h

@ -69,6 +69,7 @@
#include <tqvaluelist.h>
#include <tqregexp.h>
#include <dcopref.h>
#include <kshred.h>
#include <kdebug.h>
#include <kurl.h>
@ -1617,6 +1618,31 @@ void FileProtocol::unmount( const TQString& _point )
#endif /* HAVE_VOLMGT */
err = testLogFile( tmp );
if (err.contains("fstab") || err.contains("root")) {
TQString olderr;
err = TQString::null;
DCOPRef d("kded", "mediamanager");
d.setDCOPClient ( dcopClient() );
DCOPReply reply = d.call("properties", _point);
TQString udi;
if ( reply.isValid() ) {
TQStringList list = reply;
if (list.size())
udi = list[0];
}
if (!udi.isEmpty())
reply = d.call("unmount", udi);
if (udi.isEmpty() || !reply.isValid())
err = olderr;
else if (reply.isValid())
reply.get(err);
}
if ( err.isEmpty() )
finished();
else

@ -1275,6 +1275,16 @@ bool Ftp::ftpRename( const TQString & src, const TQString & dst, bool overwrite
return false;
}
// Must check if dst already exists, RNFR+RNTO overwrites by default (#127793).
if (ftpFileExists(dst)) {
error(ERR_FILE_ALREADY_EXIST, dst);
return false;
}
if (ftpFolder(dst, false)) {
error(ERR_DIR_ALREADY_EXIST, dst);
return false;
}
int pos = src.findRev("/");
if( !ftpFolder(src.left(pos+1), false) )
return false;
@ -2406,6 +2416,19 @@ bool Ftp::ftpSize( const TQString & path, char mode )
return true;
}
bool Ftp::ftpFileExists(const TQString& path)
{
TQCString buf;
buf = "SIZE ";
buf += remoteEncoding()->encode(path);
if( !ftpSendCmd( buf ) || (m_iRespType != 2) )
return false;
// skip leading "213 " (response code)
const char* psz = ftpResponse(4);
return psz != 0;
}
// Today the differences between ASCII and BINARY are limited to
// CR or CR/LF line terminators. Many servers ignore ASCII (like
// win2003 -or- vsftp with default config). In the early days of

@ -347,6 +347,11 @@ private:
*/
bool ftpSize( const TQString & path, char mode );
/**
* Set the current working directory, but only if not yet current
*/
bool ftpFileExists(const TQString& path);
/**
* Set the current working directory, but only if not yet current
*/

@ -1,6 +1,6 @@
[Desktop Entry]
Exec=kcmshell kresources
Icon=date
Icon=about_kde
Type=Application
Terminal=false

@ -1,7 +1,7 @@
[Desktop Entry]
Type=MimeType
MimeType=application/ogg
Icon=multimedia
Icon=sound
Patterns=*.ogg;*.OGG;
# Previous name of this mimetype
X-KDE-IsAlso=application/x-ogg

@ -2,7 +2,7 @@
Type=MimeType
MimeType=application/vnd.oasis.opendocument.formula
Patterns=*.odf;*.ODF
Icon=formula
Icon=kformula_kfo
Comment=OASIS OpenDocument Formula
Comment[af]=OASIS Oop Dokument formule
Comment[be]=Формула OASIS OpenDocument

@ -67,7 +67,7 @@ Comment[vi]=Cơ sở dữ liệu OpenOffice.org
Comment[zh_CN]=OpenOffice.org 数据库
Comment[zh_HK]=OpenOffice.org 資料庫
Comment[zh_TW]=OpenOffice.org 資料庫
Icon=spreadsheet
Icon=database
Type=MimeType
Patterns=*.odb;*.ODB;
MimeType=application/vnd.sun.xml.base

@ -1,4 +1,5 @@
[Desktop Entry]
Icon=torrent
Comment=BitTorrent Download
Comment[af]=BitTorrent Aflaai
Comment[ar]=ملف تنزيل BitTorrent

@ -85,5 +85,5 @@ MimeType=application/x-msdos-program
X-KDE-IsAlso=application/x-executable
[Property::X-KDE-NativeExtension]
Type=QString
Value=.exe
Value=.exe;.EXE;.ExE;.EXe;.eXE;.exE

@ -4,7 +4,7 @@
# application/ogg "inherits" from it, so that apps associated with x-ogg can open ogg files.
Type=MimeType
MimeType=application/x-ogg
Icon=multimedia
Icon=sound
Comment=Ogg Multimedia
Comment[ar]=وسائط Ogg متعددة
Comment[az]=Ogg Multimediya

@ -1,4 +1,5 @@
[Desktop Entry]
X-KDE-AutoEmbed=true
Type=MimeType
MimeType=application/x-rpm
Icon=rpm

@ -77,7 +77,7 @@ Comment[wa]=Documint RTF
Comment[zh_CN]=RTF 文档
Comment[zh_HK]=RTF 文件
Comment[zh_TW]=RTF 文件
Icon=wordprocessing
Icon=rtf
Type=MimeType
Patterns=*.rtf;*.RTF;
[Property::X-KDE-text]

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Loading…
Cancel
Save