diff --git a/Makefile.am.in b/Makefile.am.in
index ba1149e5e..6ce0076f2 100644
--- a/Makefile.am.in
+++ b/Makefile.am.in
@@ -18,7 +18,7 @@
# Boston, MA 02110-1301, USA.
-COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post
+COMPILE_FIRST = dcop libltdl kdefx kdecore kunittest kdeui kdesu kjs kwallet kio kded kded_post kdemm
COMPILE_BEFORE_doc = kdoctools
COMPILE_AFTER_kparts = kspell2 kmdi kdeprint kinit kate interfaces kcert khtml krandr
COMPILE_AFTER_kdeprint = kate khtml
diff --git a/catalog.xml b/catalog.xml
new file mode 100644
index 000000000..3f5dd5b15
--- /dev/null
+++ b/catalog.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dcop/KDE-ICE/Xtranssock.c b/dcop/KDE-ICE/Xtranssock.c
index 100d218b1..7b14ca9ab 100644
--- a/dcop/KDE-ICE/Xtranssock.c
+++ b/dcop/KDE-ICE/Xtranssock.c
@@ -1444,6 +1444,7 @@ UnixHostReallyLocal (char *host)
{
char hostnamebuf[256];
+ char* xauthlocalname = getenv("XAUTHLOCALHOSTNAME");
TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
@@ -1451,6 +1452,10 @@ UnixHostReallyLocal (char *host)
{
return (1);
}
+ else if(xauthlocalname && strcmp (xauthlocalname, host) == 0)
+ {
+ return (1);
+ }
else
{
/*
diff --git a/dcop/dcopc.c b/dcop/dcopc.c
index 39083d4f5..9667eb624 100644
--- a/dcop/dcopc.c
+++ b/dcop/dcopc.c
@@ -684,7 +684,9 @@ dcop_connect()
}
hostName[0] = '\0';
- if (gethostname(hostName, sizeof(hostName)))
+ if (getenv("XAUTHLOCALHOSTNAME"))
+ strlcpy(hostName, getenv("XAUTHLOCALHOSTNAME"),sizeof(hostName)-1);
+ else if (gethostname(hostName, sizeof(hostName)))
strcpy(hostName, "localhost");
else
hostName[sizeof(hostName)-1] = '\0';
diff --git a/dcop/dcopclient.cpp b/dcop/dcopclient.cpp
index e446801c9..8006ecd52 100644
--- a/dcop/dcopclient.cpp
+++ b/dcop/dcopclient.cpp
@@ -277,7 +277,9 @@ static TQCString dcopServerFile(const TQCString &hostname, bool old)
{
char hostName[256];
hostName[0] = '\0';
- if (gethostname(hostName, sizeof(hostName)))
+ if (getenv("XAUTHLOCALHOSTNAME"))
+ fName += getenv("XAUTHLOCALHOSTNAME");
+ else if (gethostname(hostName, sizeof(hostName)))
{
fName += "localhost";
}
diff --git a/dcop/dcopserver_shutdown.c b/dcop/dcopserver_shutdown.c
index 46a847660..fb25a86fa 100644
--- a/dcop/dcopserver_shutdown.c
+++ b/dcop/dcopserver_shutdown.c
@@ -95,7 +95,9 @@ static void getDCOPFile(char *dcop_file, char *dcop_file_old, int max_length)
strncat(dcop_file, "/.DCOPserver_", n);
n -= strlen("/.DCOPserver_");
- if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
+ if (getenv("XAUTHLOCALHOSTNAME"))
+ strncat(dcop_file+strlen(dcop_file), getenv("XAUTHLOCALHOSTNAME"), n);
+ else if (gethostname(dcop_file+strlen(dcop_file), n) != 0)
{
perror("Error. Could not determine hostname: ");
dcop_file[0] = '\0';
diff --git a/interfaces/kimproxy/library/kimproxy.cpp b/interfaces/kimproxy/library/kimproxy.cpp
index d3cf1ef24..44f828a02 100644
--- a/interfaces/kimproxy/library/kimproxy.cpp
+++ b/interfaces/kimproxy/library/kimproxy.cpp
@@ -204,7 +204,7 @@ KIMProxy::KIMProxy( DCOPClient* dc ) : DCOPObject( "KIMProxyIface" ), TQObject()
// FIXME: make this work when the sender object id is set to KIMIFace
if ( !connectDCOPSignal( 0, 0, method, method, false ) )
- KMessageBox::information( 0, TQString( "Couldn't connect DCOP signal.\nWon't receive any status notifications!" ) );
+ kdWarning() << "Couldn't connect DCOP signal. Won't receive any status notifications!" << endl;
}
KIMProxy::~KIMProxy( )
diff --git a/interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp b/interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp
index 11fa58f27..79ef97e42 100644
--- a/interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp
+++ b/interfaces/kmediaplayer/kfileaudiopreview/kfileaudiopreview.cpp
@@ -13,7 +13,7 @@
#include
#include
-#include
+#include
#include
@@ -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 )
diff --git a/kate/part/katehighlight.cpp b/kate/part/katehighlight.cpp
index 655452184..50c941c15 100644
--- a/kate/part/katehighlight.cpp
+++ b/kate/part/katehighlight.cpp
@@ -3225,7 +3225,7 @@ void KateHlManager::getDefaults(uint schema, KateAttributeList &list)
list.append(charAttribute);
KateAttribute* string = new KateAttribute();
- string->setTextColor(TQColor::TQColor("#D00"));
+ string->setTextColor(TQColor("#D00"));
string->setSelectedTextColor(Qt::red);
list.append(string);
@@ -3242,9 +3242,9 @@ void KateHlManager::getDefaults(uint schema, KateAttributeList &list)
KateAttribute* alert = new KateAttribute();
alert->setTextColor(Qt::black);
- alert->setSelectedTextColor( TQColor::TQColor("#FCC") );
+ alert->setSelectedTextColor( TQColor("#FCC") );
alert->setBold(true);
- alert->setBGColor( TQColor::TQColor("#FCC") );
+ alert->setBGColor( TQColor("#FCC") );
list.append(alert);
KateAttribute* functionAttribute = new KateAttribute();
diff --git a/kdecore/eventsrc b/kdecore/eventsrc
index 15b1016dc..0377e819a 100644
--- a/kdecore/eventsrc
+++ b/kdecore/eventsrc
@@ -2572,7 +2572,7 @@ Comment[wa]=On messaedje critike est håyné
Comment[zh_CN]=正在显示关键消息
Comment[zh_HK]=顯示嚴重警告訊息
Comment[zh_TW]=嚴重的警告訊息已顯示
-default_sound=KDE_Glass_Break.ogg
+default_sound=KDE_Error_1.ogg
default_presentation=65
nopresentation=18
level=4
diff --git a/kdecore/fakes.c b/kdecore/fakes.c
index 481eb6880..14f162eca 100644
--- a/kdecore/fakes.c
+++ b/kdecore/fakes.c
@@ -323,6 +323,7 @@ KDECORE_EXPORT int revoke(const char *tty)
#endif
#ifndef HAVE_STRLCPY
+#include
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
KDECORE_EXPORT unsigned long strlcat(char* d, const char* s, unsigned long bufsize)
{
char *cp;
diff --git a/kdecore/kapplication.cpp b/kdecore/kapplication.cpp
index 8edc1d170..3dc8ca77d 100644
--- a/kdecore/kapplication.cpp
+++ b/kdecore/kapplication.cpp
@@ -41,6 +41,7 @@
#include
#include
#include
+#include
#ifndef QT_NO_SQL
#include
#endif
@@ -87,6 +88,8 @@
#include
#endif
#include
+#include
+#include
#ifndef Q_WS_WIN
#include "kwin.h"
@@ -776,10 +779,15 @@ void KApplication::init(bool GUIenabled)
{
d->guiEnabled = GUIenabled;
if ((getuid() != geteuid()) ||
- (getgid() != getegid()))
+ (getgid() != getegid()) )
{
- fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
- ::exit(127);
+ // man permissions are not exploitable and better than
+ // world writable directories
+ struct group *man = getgrnam("man");
+ if ( !man || man->gr_gid != getegid() ){
+ fprintf(stderr, "The KDE libraries are not designed to run with suid privileges.\n");
+ ::exit(127);
+ }
}
KProcessController::ref();
@@ -2137,6 +2145,12 @@ void KApplication::propagateSettings(SettingsCategory arg)
KConfigBase* config = KGlobal::config();
KConfigGroupSaver saver( config, "KDE" );
+#ifdef QT_HAVE_MAX_IMAGE_SIZE
+ TQSize maxImageSize(4096, 4096);
+ maxImageSize = config->readSizeEntry("MaxImageSize", &maxImageSize);
+ TQImage::setMaxImageSize(maxImageSize);
+#endif
+
int num = config->readNumEntry("CursorBlinkRate", TQApplication::cursorFlashTime());
if ((num != 0) && (num < 200))
num = 200;
diff --git a/kdecore/kcatalogue.cpp b/kdecore/kcatalogue.cpp
index 8bc81125e..3669b40b4 100644
--- a/kdecore/kcatalogue.cpp
+++ b/kdecore/kcatalogue.cpp
@@ -66,7 +66,11 @@ KCatalogue::KCatalogue(const TQString & name, const TQString & language )
.arg( d->language )
.arg( d->name );
- setFileName( locate( "locale", path ) );
+ TQString fileName = locate( "locale", path );
+ if (fileName.isEmpty())
+ fileName = locate( "locale-bundle", path );
+
+ setFileName( fileName );
}
diff --git a/kdecore/kconfigbase.cpp b/kdecore/kconfigbase.cpp
index 56f5292ae..1cbe1f3ab 100644
--- a/kdecore/kconfigbase.cpp
+++ b/kdecore/kconfigbase.cpp
@@ -131,6 +131,24 @@ bool KConfigBase::hasKey(const char *pKey) const
return !entry.mValue.isNull();
}
+bool KConfigBase::hasTranslatedKey(const char* pKey) const
+{
+ KEntryKey aEntryKey(mGroup, 0);
+ aEntryKey.c_key = pKey;
+ aEntryKey.bDefault = readDefaults();
+
+ if (!locale().isNull()) {
+ // try the localized key first
+ aEntryKey.bLocal = true;
+ KEntry entry = lookupData(aEntryKey);
+ if (!entry.mValue.isNull())
+ return true;
+ aEntryKey.bLocal = false;
+ }
+
+ return false;
+}
+
bool KConfigBase::hasGroup(const TQString &group) const
{
return internalHasGroup( group.utf8());
diff --git a/kdecore/kconfigbase.h b/kdecore/kconfigbase.h
index 69c7c3bc0..cc7ad8ffe 100644
--- a/kdecore/kconfigbase.h
+++ b/kdecore/kconfigbase.h
@@ -1985,6 +1985,7 @@ public:
protected:
TQCString readEntryUtf8( const char *pKey) const;
+ bool hasTranslatedKey( const char *pKey ) const;
/**
* The currently selected group. */
diff --git a/kdecore/kcrash.cpp b/kdecore/kcrash.cpp
index 2a908670b..5642500f8 100644
--- a/kdecore/kcrash.cpp
+++ b/kdecore/kcrash.cpp
@@ -466,7 +466,9 @@ static int openSocket()
sock_file[strlen(sock_file)-1] = 0;
strncat(sock_file, "/socket-", MAX_SOCK_FILE - strlen(sock_file));
- if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
+ if( getenv("XAUTHLOCALHOSTNAME"))
+ strncat(sock_file, getenv("XAUTHLOCALHOSTNAME"), MAX_SOCK_FILE - strlen(sock_file) - 1);
+ else if (gethostname(sock_file+strlen(sock_file), MAX_SOCK_FILE - strlen(sock_file) - 1) != 0)
{
perror("Warning: Could not determine hostname: ");
return -1;
diff --git a/kdecore/kdesktopfile.cpp b/kdecore/kdesktopfile.cpp
index c8a98e973..09a3f1e9b 100644
--- a/kdecore/kdesktopfile.cpp
+++ b/kdecore/kdesktopfile.cpp
@@ -34,6 +34,8 @@
#include "kapplication.h"
#include "kstandarddirs.h"
#include "kmountpoint.h"
+#include "kcatalogue.h"
+#include "klocale.h"
#include "kdesktopfile.h"
#include "kdesktopfile.moc"
@@ -145,6 +147,27 @@ bool KDesktopFile::isAuthorizedDesktopFile(const TQString& path)
return false;
}
+TQString KDesktopFile::translatedEntry(const char* key) const
+{
+ if (hasTranslatedKey(key))
+ return readEntry(key);
+
+ if (hasKey(key)) {
+ TQString value = readEntryUntranslated(key);
+ TQString fName = fileName();
+ fName = fName.mid(fName.findRev('/')+1);
+ TQString po_lookup_key = TQString::fromLatin1(key) + "(" + fName + "): " + value;
+ TQString po_value = KGlobal::locale()->translate(po_lookup_key.utf8().data());
+
+ if (po_value == po_lookup_key)
+ return value;
+
+ return po_value;
+ }
+
+ return TQString::null;
+}
+
TQString KDesktopFile::readType() const
{
return readEntry("Type");
@@ -157,17 +180,17 @@ TQString KDesktopFile::readIcon() const
TQString KDesktopFile::readName() const
{
- return readEntry("Name");
+ return translatedEntry("Name");
}
TQString KDesktopFile::readComment() const
{
- return readEntry("Comment");
+ return translatedEntry("Comment");
}
TQString KDesktopFile::readGenericName() const
{
- return readEntry("GenericName");
+ return translatedEntry("GenericName");
}
TQString KDesktopFile::readPath() const
@@ -342,5 +365,3 @@ KDesktopFile* KDesktopFile::copyTo(const TQString &file) const
config->setDesktopGroup();
return config;
}
-
-
diff --git a/kdecore/kdesktopfile.h b/kdecore/kdesktopfile.h
index dcbe3ea1d..bb705b696 100644
--- a/kdecore/kdesktopfile.h
+++ b/kdecore/kdesktopfile.h
@@ -236,6 +236,8 @@ private:
private:
+ TQString translatedEntry(const char*) const;
+
// copy-construction and assignment are not allowed
KDesktopFile( const KDesktopFile& );
KDesktopFile& operator= ( const KDesktopFile& );
diff --git a/kdecore/klocale.cpp b/kdecore/klocale.cpp
index f83ec6be1..91fe1c2a1 100644
--- a/kdecore/klocale.cpp
+++ b/kdecore/klocale.cpp
@@ -408,7 +408,11 @@ TQString KLocale::catalogueFileName(const TQString & language,
.arg( language )
.arg( catalog.name() );
- return locate( "locale", path );
+ TQString fileName = locate( "locale", path );
+ if (fileName.isEmpty())
+ fileName = locate( "locale-bundle", path );
+
+ return fileName;
}
bool KLocale::setLanguage(const TQString & language)
@@ -507,6 +511,9 @@ bool KLocale::isApplicationTranslatedInto( const TQString & language)
// kdDebug() << "isApplicationTranslatedInto: filename " << sFileName << endl;
TQString sAbsFileName = locate( "locale", sFileName );
+ if (sAbsFileName.isEmpty())
+ sAbsFileName = locate( "locale-bundle", sFileName );
+
// kdDebug() << "isApplicationTranslatedInto: absname " << sAbsFileName << endl;
return ! sAbsFileName.isEmpty();
}
diff --git a/kdecore/kstandarddirs.cpp b/kdecore/kstandarddirs.cpp
index 2568dc7df..800c0e191 100644
--- a/kdecore/kstandarddirs.cpp
+++ b/kdecore/kstandarddirs.cpp
@@ -94,13 +94,13 @@ KStandardDirsSingleton* KStandardDirsSingleton::self() {
return s_self;
}
-static const char* const types[] = {"html", "icon", "apps", "sound",
- "data", "locale", "services", "mime",
+static const char* const types[] = {"html", "html-bundle", "icon", "apps", "sound",
+ "data", "locale", "locale-bundle", "services", "mime",
"servicetypes", "config", "exe",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu",
- "xdgdata-icon", "xdgdata-pixmap",
+ "xdgdata-icon", "xdgdata-pixmap", "xdgconf-autostart",
"kcfg", "emoticons", 0 };
static int tokenize( TQStringList& token, const TQString& str,
@@ -719,7 +719,10 @@ void KStandardDirs::createSpecialResource(const char *type)
{
char hostname[256];
hostname[0] = 0;
- gethostname(hostname, 255);
+ if( getenv("XAUTHLOCALHOSTNAME"))
+ strlcpy(hostname, getenv("XAUTHLOCALHOSTNAME"), 255 );
+ else
+ gethostname(hostname, 255);
TQString dir = TQString("%1%2-%3").arg(localkdedir()).arg(type).arg(hostname);
char link[1024];
link[1023] = 0;
@@ -1024,6 +1027,8 @@ static int tokenize( TQStringList& tokens, const TQString& str,
TQString KStandardDirs::kde_default(const char *type) {
if (!strcmp(type, "data"))
return "share/apps/";
+ if (!strcmp(type, "html-bundle"))
+ return "share/doc-bundle/HTML/";
if (!strcmp(type, "html"))
return "share/doc/kde/HTML/";
if (!strcmp(type, "icon"))
@@ -1036,6 +1041,8 @@ TQString KStandardDirs::kde_default(const char *type) {
return "share/applnk/";
if (!strcmp(type, "sound"))
return "share/sounds/";
+ if (!strcmp(type, "locale-bundle"))
+ return "share/locale-bundle/";
if (!strcmp(type, "locale"))
return "share/locale/";
if (!strcmp(type, "services"))
@@ -1068,6 +1075,8 @@ TQString KStandardDirs::kde_default(const char *type) {
return "desktop-directories/";
if (!strcmp(type, "xdgconf-menu"))
return "menus/";
+ if (!strcmp(type, "xdgconf-autostart"))
+ return "autostart/";
if (!strcmp(type, "kcfg"))
return "share/config.kcfg";
if (!strcmp(type, "emoticons"))
diff --git a/kdecore/kwinmodule.cpp b/kdecore/kwinmodule.cpp
index 7e4d4f773..f113570db 100644
--- a/kdecore/kwinmodule.cpp
+++ b/kdecore/kwinmodule.cpp
@@ -436,7 +436,9 @@ TQRect KWinModule::workArea( const TQValueList& 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;
}
diff --git a/kded/Makefile.am b/kded/Makefile.am
index 8437919f0..d8ebac458 100644
--- a/kded/Makefile.am
+++ b/kded/Makefile.am
@@ -36,12 +36,16 @@ kbuildsycoca_la_SOURCES = kbuildsycoca.cpp kbuildservicetypefactory.cpp \
kctimefactory.cpp \
vfolder_menu.cpp
-bin_PROGRAMS = kdontchangethehostname kde-menu
+bin_PROGRAMS = kdontchangethehostname kde-menu kmimelist
kdontchangethehostname_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kdontchangethehostname_LDADD = $(LIB_KDECORE)
kdontchangethehostname_SOURCES = khostname.cpp
+kmimelist_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+kmimelist_LDADD = ../kio/libkio.la
+kmimelist_SOURCES = kmimelist.cpp
+
kde_menu_LDFLAGS = $(all_libraries) $(KDE_RPATH)
kde_menu_LDADD = $(LIB_KIO)
kde_menu_SOURCES = kde-menu.cpp
diff --git a/kded/khostname.cpp b/kded/khostname.cpp
index e38c88f53..0fa837a2c 100644
--- a/kded/khostname.cpp
+++ b/kded/khostname.cpp
@@ -111,7 +111,8 @@ static QCStringList split(const TQCString &str)
void KHostName::changeX()
{
- TQString cmd = "xauth list";
+ const char* xauthlocalhostname = getenv("XAUTHLOCALHOSTNAME");
+ TQString cmd = "xauth -n list";
FILE *xFile = popen(TQFile::encodeName(cmd), "r");
if (!xFile)
{
@@ -123,6 +124,7 @@ void KHostName::changeX()
char buf[1024+1];
while (!feof(xFile))
{
+ buf[1024]='\0';
TQCString line = fgets(buf, 1024, xFile);
if (line.length())
line.truncate(line.length()-1); // Strip LF.
@@ -157,12 +159,17 @@ void KHostName::changeX()
TQCString newNetId = newName+netId.mid(i);
TQCString oldNetId = netId.left(i);
- if(oldNetId != oldName)
- continue;
+ if(oldNetId != oldName
+ && (!xauthlocalhostname || strcmp(xauthlocalhostname, oldNetId.data()) != 0))
+ continue;
- cmd = "xauth remove "+KProcess::quote(netId);
- system(TQFile::encodeName(cmd));
- cmd = "xauth add ";
+ // don't nuke the xauth when XAUTHLOCALHOSTNAME points to it
+ if (!xauthlocalhostname || oldNetId != xauthlocalhostname)
+ {
+ cmd = "xauth -n remove "+KProcess::quote(netId);
+ system(TQFile::encodeName(cmd));
+ }
+ cmd = "xauth -n add ";
cmd += KProcess::quote(newNetId);
cmd += " ";
cmd += KProcess::quote(authName);
@@ -276,7 +283,10 @@ void KHostName::changeDcop()
}
}
- // Remove old entries
+ // Remove old entries, but only if XAUTHLOCALHOSTNAME doesn't point
+ // to it
+ char* xauthlocalhostname = getenv("XAUTHLOCALHOSTNAME");
+ if (!xauthlocalhostname || !oldNetId.contains(xauthlocalhostname))
{
TQString cmd = "iceauth remove "+KProcess::quote("netid="+oldNetId);
system(TQFile::encodeName(cmd));
@@ -368,9 +378,7 @@ int main(int argc, char **argv)
KHostName hn;
- if(!getenv("XAUTHLOCALHOSTNAME"))
- hn.changeX();
-
+ hn.changeX();
hn.changeDcop();
hn.changeStdDirs("socket");
hn.changeStdDirs("tmp");
diff --git a/kded/kmimelist.cpp b/kded/kmimelist.cpp
new file mode 100644
index 000000000..a08484bc6
--- /dev/null
+++ b/kded/kmimelist.cpp
@@ -0,0 +1,54 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+
+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 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 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 it2(ol.begin());
+ for (; it2 != ol.end(); ++it2) {
+ if ((*it2).allowAsDefault())
+ printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
+
+ }
+ printf( "\n" );
+ }
+ }
+}
+
diff --git a/kdefx/kstyle.cpp b/kdefx/kstyle.cpp
index 531775dbf..dc5216125 100644
--- a/kdefx/kstyle.cpp
+++ b/kdefx/kstyle.cpp
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
#include
#include
@@ -79,7 +80,7 @@ namespace
TQWidget* w1;
TQWidget* w2;
};
- typedef TQMap ShadowMap;
+ typedef TQMap ShadowMap;
static ShadowMap *_shadowMap = 0;
TQSingleCleanupHandler cleanupShadowMap;
ShadowMap &shadowMap() {
@@ -113,8 +114,13 @@ namespace
const double shadow_strip[4] =
{ 0.565, 0.675, 0.835, 0.945 };
-}
+ static bool useDropShadow(TQWidget* w)
+ {
+ return w && w->metaObject() &&
+ w->metaObject()->findProperty("KStyleMenuDropShadow") != -1;
+ }
+}
namespace
{
@@ -128,12 +134,12 @@ class TransparencyHandler : public QObject
protected:
void blendToColor(const TQColor &col);
- void blendToPixmap(const TQColorGroup &cg, const TQPopupMenu* p);
+ void blendToPixmap(const TQColorGroup &cg, const TQWidget* p);
#ifdef HAVE_XRENDER
- void XRenderBlendToPixmap(const TQPopupMenu* p);
+ void XRenderBlendToPixmap(const TQWidget* p);
#endif
- void createShadowWindows(const TQPopupMenu* p);
- void removeShadowWindows(const TQPopupMenu* p);
+ void createShadowWindows(const TQWidget* p);
+ void removeShadowWindows(const TQWidget* p);
void rightShadow(TQImage& dst);
void bottomShadow(TQImage& dst);
private:
@@ -256,8 +262,16 @@ void KStyle::polish( TQWidget* widget )
widget->installEventFilter(this);
}
}
-}
+ if (widget->isTopLevel())
+ {
+ if (!d->menuHandler && useDropShadow(widget))
+ d->menuHandler = new TransparencyHandler(this, Disabled, 1.0, false);
+ if (d->menuHandler && useDropShadow(widget))
+ widget->installEventFilter(d->menuHandler);
+ }
+}
+
void KStyle::unPolish( TQWidget* widget )
{
@@ -267,8 +281,10 @@ void KStyle::unPolish( TQWidget* widget )
TQFrame::Shape shape = frame->frameShape();
if (shape == TQFrame::ToolBarPanel || shape == TQFrame::MenuBarPanel)
widget->removeEventFilter(this);
- }
+ }
}
+ if (widget->isTopLevel() && d->menuHandler && useDropShadow(widget))
+ widget->removeEventFilter(d->menuHandler);
}
@@ -2016,7 +2032,7 @@ void TransparencyHandler::bottomShadow(TQImage& dst)
}
// Create a shadow of thickness 4.
-void TransparencyHandler::createShadowWindows(const TQPopupMenu* p)
+void TransparencyHandler::createShadowWindows(const TQWidget* p)
{
#ifdef Q_WS_X11
int x2 = p->x()+p->width();
@@ -2063,7 +2079,7 @@ void TransparencyHandler::createShadowWindows(const TQPopupMenu* p)
#endif
}
-void TransparencyHandler::removeShadowWindows(const TQPopupMenu* p)
+void TransparencyHandler::removeShadowWindows(const TQWidget* p)
{
#ifdef Q_WS_X11
ShadowMap::iterator it = shadowMap().find(p);
@@ -2089,7 +2105,7 @@ bool TransparencyHandler::eventFilter( TQObject* object, TQEvent* event )
// Copyright (C) 2000 Daniel M. Duley
// 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(p))
+ kstyle->renderMenuBlendPixmap( blendPix, cg, ::qt_cast(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(p))
+ kstyle->renderMenuBlendPixmap( renderPix, p->colorGroup(),
+ ::qt_cast(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;
diff --git a/kdemm/0.png b/kdemm/0.png
new file mode 100644
index 000000000..0c65b5cc8
Binary files /dev/null and b/kdemm/0.png differ
diff --git a/kdemm/DESIGN b/kdemm/DESIGN
new file mode 100644
index 000000000..524f64faa
--- /dev/null
+++ b/kdemm/DESIGN
@@ -0,0 +1,31 @@
+There should be at least two libs:
+1. kdemm(core)
+==============
+
+Provides the wrapper for the media framework and all needed media functionality.
+Whether this lib needs to depend on kdeui? Depends on how we could handle video
+without UI... but if possible we should put the video-widget in kdemmwidgets.
+
+The Requirements & Specification document can be found in reqspec.html
+
+
+2. kdemmwidgets
+===============
+
+Provides convenience widgets for the common widgets that are needed:
+- Position slider (display position and move it to seek)
+- Volume fader
+- Effects dialog (including EQ)
+- Video widget
+- Player controls as toolbar
+
+
+Also there could be a KPart:
+3. kdemmpart
+============
+
+A KPart implementing the KMediaPlayer interface.
+
+
+
+// vim: tw=80
diff --git a/kdemm/Makefile.am b/kdemm/Makefile.am
new file mode 100644
index 000000000..9bab914ef
--- /dev/null
+++ b/kdemm/Makefile.am
@@ -0,0 +1,43 @@
+# This file is part of the KDE libraries
+# Copyright (C) 2004 Matthias Kretz
+
+# 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
+
diff --git a/kdemm/TODO b/kdemm/TODO
new file mode 100644
index 000000000..457bc6f0a
--- /dev/null
+++ b/kdemm/TODO
@@ -0,0 +1,27 @@
+Factory
+- get a list of available backends
+- be able to choose the one you want to use, overriding the KTrader information
+- test on the fly switching
+
+Audio
+- function to retrieve the PCM data that currently is played (could be done in
+ the Channel as well as in the Player)
+
+Video
+- either a new interface or somehow integrate into the player
+ If it's a new interface we have to copy most of the Player class, which I
+ wouldn't like to see.
+
+two wrapper APIs:
+- for notifications
+ play file and don't care
+ automatically use the notification channel if present
+- for simple players
+ open file and provide seek and volume
+
+Mixer abstraction
+- provide access to the hardware mixer and/or the mixer of the backend
+- provide access to software volume controls (like the Channels)
+
+Record Interface
+- simple PCM recording API
diff --git a/kdemm/backend.cpp b/kdemm/backend.cpp
new file mode 100644
index 000000000..715fc52de
--- /dev/null
+++ b/kdemm/backend.cpp
@@ -0,0 +1,78 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+
+#include
+#include
+#include
+
+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
diff --git a/kdemm/backend.h b/kdemm/backend.h
new file mode 100644
index 000000000..2f626c4f4
--- /dev/null
+++ b/kdemm/backend.h
@@ -0,0 +1,86 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+#include
+
+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
+ * \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
diff --git a/kdemm/channel.cpp b/kdemm/channel.cpp
new file mode 100644
index 000000000..fa1d662f9
--- /dev/null
+++ b/kdemm/channel.cpp
@@ -0,0 +1,69 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Scott Wheeler
+
+ 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
+
+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
diff --git a/kdemm/channel.h b/kdemm/channel.h
new file mode 100644
index 000000000..6e47febac
--- /dev/null
+++ b/kdemm/channel.h
@@ -0,0 +1,96 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+
+class TQString;
+
+namespace KDE
+{
+namespace Multimedia
+{
+ /**
+ * \short Abstraction of different inputs or outputs
+ *
+ * \author Matthias Kretz
+ * \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
diff --git a/kdemm/factory.cpp b/kdemm/factory.cpp
new file mode 100644
index 000000000..1994b8e5e
--- /dev/null
+++ b/kdemm/factory.cpp
@@ -0,0 +1,296 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+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 = "";
+ 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( "%1 | %2 |
" )
+ .arg( ( *oit )->name() ).arg( *eit );
+ details += "
";
+
+ KMessageBox::detailedError( 0,
+ i18n( "Unable to use any of the available Multimedia Backends" ), details );
+ }
+ }
+#endif
+ }
+
+ Backend * backend;
+ KService::Ptr service;
+
+ TQValueList 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
diff --git a/kdemm/factory.h b/kdemm/factory.h
new file mode 100644
index 000000000..c9ed2e3da
--- /dev/null
+++ b/kdemm/factory.h
@@ -0,0 +1,222 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+#include
+#include
+
+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
+ * \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
diff --git a/kdemm/mixeriface.h b/kdemm/mixeriface.h
new file mode 100644
index 000000000..8ee9fc96b
--- /dev/null
+++ b/kdemm/mixeriface.h
@@ -0,0 +1,41 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+
+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
diff --git a/kdemm/mmbackendinfo.desktop b/kdemm/mmbackendinfo.desktop
new file mode 100644
index 000000000..001a48c58
--- /dev/null
+++ b/kdemm/mmbackendinfo.desktop
@@ -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
+#
diff --git a/kdemm/player.cpp b/kdemm/player.cpp
new file mode 100644
index 000000000..b16c942fc
--- /dev/null
+++ b/kdemm/player.cpp
@@ -0,0 +1,53 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
diff --git a/kdemm/player.h b/kdemm/player.h
new file mode 100644
index 000000000..b753073a7
--- /dev/null
+++ b/kdemm/player.h
@@ -0,0 +1,259 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+
+class KURL;
+
+namespace KDE
+{
+namespace Multimedia
+{
+ class Channel;
+ /**
+ * \short Interface for accessing media playback functions
+ *
+ * \author Matthias Kretz
+ * \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
diff --git a/kdemm/reqspec.html b/kdemm/reqspec.html
new file mode 100644
index 000000000..a07860c79
--- /dev/null
+++ b/kdemm/reqspec.html
@@ -0,0 +1,533 @@
+Requirements & Specification
+Requirements & Specification
+
+
+1. Problem Statement
+
+KDE needs to integrate better into existing Multimedia solutions for Linux.
+
+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.
+
+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.
+
+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.
+
+The API does not aim to be a general Linux solution to multimedia. It aims to be the solution for all KDE developers.
+
+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.
+
+
+2. Requirements
+
+
+2.1. Actors
+
+
+Actor: Admin
+
+Description | Administrates a KDE installation. Most users are their own admins... |
+
+Initiated User Tasks | configure Multimedia sytems |
+
+Initiated Use Cases | Configure kdemm |
+
+
+
+
+Actor: KDE Developer
+
+Description | The average KDE Developer who might need some multimedia functionality, like playing a media object, for his program. |
+
+Initiated User Tasks | add media playback to his program |
+
+Initiated Use Cases | add media playback functionality to a program, initialize kdemm |
+
+
+
+
+Actor: KDE Multimedia Developer
+
+Description | KDE Developer writing a media application like a jukebox or full-featured media player. |
+
+Initiated User Tasks | Develop Media Player |
+
+Initiated Use Cases | media playback, manage video window, modify audio path, play media object, load media object, create reusable audio path, crossfading |
+
+
+
+
+Actor: KDE User
+
+Description | User of the K Desktop Environment. |
+
+Initiated User Tasks | change audio output volume |
+
+Initiated Use Cases | change audio volume |
+
+
+
+
+2.2. User Tasks
+
+Actor Admin initilizes the following user tasks
+
+
+User Task: configure Multimedia sytems
+
+Description | His aim is to make all multimedia applications work happily side by side.
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.
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).
It is important to have it correctly configured else the user will have problems whenever he uses multimedia programs.
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. |
+
+Realized in Use Cases | Configure kdemm |
+
+
+
+
+
+Actor KDE Developer initilizes the following user tasks
+
+
+User Task: add media playback to his program
+
+Description | 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.
He can select from a lot of choices how to achieve his goal. - write the relevant audio/video code himself - select and use a media framework like gstreamer or aRts - use existing code from kdelibs (might not be enough for what he's trying to do)
A lot of programs nowadays need to have multimedia functionality.
It's important that KDE developers can add multimedia functionality to their programs. |
+
+Realized in Use Cases | add media playback functionality to a program |
+
+
+
+
+
+Actor KDE Multimedia Developer initilizes the following user tasks
+
+
+User Task: Develop Media Player
+
+Description | 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.
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.
Reason: A modern desktop environment needs to have a modern media player with all the latest bells and whistles.
Priority: It is important that KDE has "native" media players.
Info-In: - knowledge about what other media players can do - features asked for by users (e.g. EQ is a must have for some users) |
+
+Realized in Use Cases | media playback, manage video window, modify audio path, play media object, load media object, create reusable audio path, crossfading |
+
+
+
+
+
+Actor KDE User initilizes the following user tasks
+
+
+User Task: change audio output volume
+
+Description | The user wants to change the volume of some program because it is too loud compared to the sound of another program.
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.
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.
It might happen a few times a day that a user needs this functionality. |
+
+Realized in Use Cases | change audio volume |
+
+
+
+
+2.3. Domain Data
+
+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.
+
+
+
+
+2.4. Domain Constraints
+
+Network transparency | 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. |
+
+
+
+
+2.5. Quality Constraints
+
+
+2.6. Interaction Data
+
+
+3. Specification
+
+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.
+
+
+3.1. Use Cases
+
+
+Use Case: add media playback functionality to a program
+
+Initiating Actor | KDE Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | Tell kdemm what media object you want to play back. | |
+
+ | | Check whether the media object is one of the known types that the backend can decode. If it cannot be decoded error out. |
+
+ | | Prepare for being asked to play back the media object, to seek in it or other operations. |
+
+ | a) Ask for meta information of the current media object. (e.g. length, bitrate, etc.) --> go on with step 5
or
b) asking kdemm to play the media object --> go on with step 7 | |
+
+ | | read out meta information, either using the media backend if it supports this function, or using other external libs |
+
+ | display meta information on the GUI while asking kdemm to play the media object | |
+
+ | | Tell media backend to start playing. |
+
+ | Wait for notification that the media object has finished playing. Remove display of meta info and clean up all used datastructures. | |
+
+
+
+
+Use Case: change audio volume
+
+Initiating Actor | KDE User | |
+
+Preconditions | a kdemm using program (let's call it A) is running with its volume being x | |
+
+FlowSteps | Actor | System |
+
+ | open KDE Mixer Window | |
+
+ | | look for all available volume controls and show them (with informative description what control does what) to the user |
+
+ | locate the control for A and move the fader down | |
+
+ | | decrease the output volume of A |
+
+Postconditions | A is running with output volume y < x | |
+
+
+
+
+Use Case: Configure kdemm
+
+Initiating Actor | Admin | |
+
+Preconditions | KDE is installed and the backends the Admin wants to use are installed. | |
+
+FlowSteps | Actor | System |
+
+ | open kdemm admin tool | |
+
+ | | 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. For the selected media framework there might be more options that need to be shown. 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) |
+
+ | select another media framework | |
+
+ | | Change audio output options according to what the framework supports.
Provide access to the configuration options of the just selected media framework. |
+
+ | take a look at media framework config options | |
+
+ | | show media framework config options (e.g. NMM might show some network related options here) |
+
+ | tweak a few settings | |
+
+ | | write config out so that programs using kdemm behave like configured |
+
+ | change default audio output | |
+
+ | | Set the media framework to use the specified audio output.
Provide access to the configuration options of the newly selected audio output. |
+
+ | save settings and close admin tool | |
+
+ | | write out all configuration and tell all kdemm programs to use the new configuration |
+
+
+
+
+Use Case: create reusable audio path
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | Ask kdemm for an "audio path" | |
+
+ | | Create a representation for the flow graph audio normally takes from the media object to the output and return an interface to it. |
+
+ | Ask for a list of effects that can be inserted into the audio path. | |
+
+ | | 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) |
+
+ | Create list of effects and let the user decide what effects he wants. Tell kdemm to insert effects into the audio path. | |
+
+ | | Prepare an audio path with the selected effects for later use. |
+
+ | optional steps: The user decides to configure the parameters of one effect. | |
+
+ | | Return a Widget showing the parameters the effect has so that the user can configure the effects. |
+
+ | Ask kdemm to save the state of the current audio path to a configuration object. | |
+
+ | | Look at current audio path, the contained effects and the parameters of the effects. Write those values in the configuration object. |
+
+ | load media | |
+
+ | Tell kdemm to use the above audio path for the media object. | |
+
+ | | Change flow graph of media framework to use the selected audio path. |
+
+ | play | |
+
+
+
+
+Use Case: crossfading
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | Ask kdemm to send a notification 3 seconds before a media object finishes playing. | |
+
+ | | 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 |
+
+ | take from playlist | |
+
+ | Insert a "Fader" effect into the audio path of the media object | |
+
+ | | Change flow graph of the media framework to include the "Fader" effect. |
+
+ | play | |
+
+ | take from playlist | |
+
+ | Insert a "Fader" effect into the audio path of the media object | |
+
+ | | Change flow graph of the media framework to include the "Fader" effect. |
+
+ | 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. | |
+
+
+
+
+Use Case: initialize kdemm
+
+Initiating Actor | KDE Developer | |
+
+Preconditions | KDE and all its libraries are installed correctly. | |
+
+FlowSteps | Actor | System |
+
+ | ask kdemm to initialize | |
+
+ | | 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. |
+
+Postconditions | kdemm is initialized and ready for action | |
+
+
+
+
+Use Case: load media object
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | Tell kdemm to load a media object. | |
+
+ | | Prepare media framework for working with the media object (play, seek, etc.). |
+
+Postconditions | Media object is ready for use. | |
+
+
+
+
+Use Case: manage video window
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | Ask kdemm for a dedicated video widget. | |
+
+ | | Create widget and keep reference to it for so that all video output at some later point can be displayed in this widget. |
+
+ | optional step - can be inserted at any point from here on: | |
+
+ | Resize video widget (might also be fullscreen display). | |
+
+ | | Adjust for new video output size: video needs to be scaled to fit into the widget. |
+
+ | Ask for available video ratio options. | |
+
+ | | Ask media framework for available video ratio options. If the media framework doesn't provide any options Mark the currently used option. |
+
+ | Select one of the ratio options. | |
+
+ | | Change video ratio. |
+
+
+
+
+Use Case: media playback
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | Tell kdemm to send a notification whenever a media object is about to finish playing. | |
+
+ | | 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 |
+
+ | Take first media object from the playlist | |
+
+ | play | |
+
+ | When notified that the playback is about to end | |
+
+ | When notified that the playback has finished | |
+
+
+
+
+Use Case: modify audio path
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | the kdemm API has been initialized without errors (see use case "initialize kdemm") | |
+
+FlowSteps | Actor | System |
+
+ | load | |
+
+ | Ask for "audio path" of the media object. | |
+
+ | | 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. |
+
+ | Ask for a list of effects that can be inserted into the audio path. | |
+
+ | | 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) |
+
+ | Select an effect and tell kdemm to insert it into the audio path (the position can also be specified) | |
+
+ | | Change audio flow graph of the media framework to include the selected effect at the specified position. |
+
+ | play with effect | |
+
+
+
+
+Use Case: play media object
+
+Initiating Actor | KDE Multimedia Developer | |
+
+Preconditions | a media object has been loaded (include use case "load media object") | |
+
+FlowSteps | Actor | System |
+
+ | Ask kdemm to play the media. | |
+
+ | | Instruct the media framework to play. |
+
+
+
+
+3.2. Features
+
+
+Feature: create media object
+
+Description | Check whether the media data can be accessed and decoded. If not return an error indicating the problem. 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.) Create an object to represent the media data. |
+
+Inputs | URL to the media data |
+
+Outputs | media object |
+
+Used in Use Cases | load media object |
+
+
+
+
+Feature: init notifications
+
+Description | two cases:
if( The media framework can produce the notification in question ) {
Initialize notifications from media framework and prepare to forward them.
} else {
Use timer to send ticks and check for end of media playback.
} |
+
+Inputs | - time before media playback ends
- time between ticks
- what notifications to enable/disable (choices are: ticks, aboutToEnd, end) |
+
+Used in Use Cases | media playback, crossfading |
+
+
+
+
+3.3. Global Functional Constraints
+
+
+3.4. Quality Constraints on Use Cases
+
+
+3.5. Quality Constraints on Features
+
+
+3.6. Architectural Constraints
+
+
+3.7. User Interface Constraints
+
+
+4. Examples
+
+
+4.1. Actor Instances
+
+
+4.2. Scenarios
+
+
+5. Glossary
+
+ | admin options viewThe 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. |
+
+ | ALSAAdvanced Linux Sound Architecture: new audio interface for Linux |
+
+ | APIApplication Programmer Interface: The interface that the Application Programmer uses to interact with the kdemm framework. |
+
+ | aRtsanalog Realtime Synthesizer: the current soundserver and "media framework" of KDE |
+
+ | BCbinary 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. |
+
+ | DEDesktop Environment |
+
+ | desktopThe 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. |
+
+ | EQequalizer: audio filter to boost and attenuate selected frequencies of the signal |
+
+ | flow graphIn media frameworks the flow of media data is modeled as a flow graph. There are nodes representing data sources, data processors and data sinks. |
+
+ | gstreamerGStreamer 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. |
+
+ | GUIGraphical User Interface |
+
+ | kdemmshort for KDE Multimedia - it's the name of the library/framework the API discussed in here is going to have. |
+
+ | media objectA media object is a representation for the media data. This could be an audio or video file or stream. |
+
+ | mplayermedia player that is often used as backend for other media player GUIs |
+
+ | NMMNETWORK-INTEGRATED MULTIMEDIA MIDDLEWARE: a network-integrated multimedia infrastructure for Linux (as well as other operating systems) |
+
+ | OSSOpen Sound System: audio interface for UNIX systems |
+
+ | SDLSimple DirectMedia Layer: multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer |
+
+ | tickWhile 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. |
+
+ | URLUniform Resource Locator (http://en.wikipedia.org/wiki/Uniform_Resource_Locator) |
+
+ | userAs long as I talk about API usage the user equals the AP in API. |
+
+ | XX Window system: The client server architecture used for most UNIX GUI programs. |
+
+ | xinexine 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. |
+
+ | xvX Video: extension to X for hardware accelerated video display |
+
+
+
diff --git a/kdemm/simpleplayer.cpp b/kdemm/simpleplayer.cpp
new file mode 100644
index 000000000..71e0edb18
--- /dev/null
+++ b/kdemm/simpleplayer.cpp
@@ -0,0 +1,198 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+#include
+
+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
diff --git a/kdemm/simpleplayer.h b/kdemm/simpleplayer.h
new file mode 100644
index 000000000..f9575d21f
--- /dev/null
+++ b/kdemm/simpleplayer.h
@@ -0,0 +1,72 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+#include
+
+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
diff --git a/kdemm/test/Makefile.am b/kdemm/test/Makefile.am
new file mode 100644
index 000000000..d488da365
--- /dev/null
+++ b/kdemm/test/Makefile.am
@@ -0,0 +1,30 @@
+# This file is part of the KDE libraries
+# Copyright (C) 2004 Matthias Kretz
+
+# 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
diff --git a/kdemm/test/main.cpp b/kdemm/test/main.cpp
new file mode 100644
index 000000000..eb42dc1ec
--- /dev/null
+++ b/kdemm/test/main.cpp
@@ -0,0 +1,38 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+#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
diff --git a/kdemm/test/statetest.cpp b/kdemm/test/statetest.cpp
new file mode 100644
index 000000000..48ae444ee
--- /dev/null
+++ b/kdemm/test/statetest.cpp
@@ -0,0 +1,299 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+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
diff --git a/kdemm/test/statetest.h b/kdemm/test/statetest.h
new file mode 100644
index 000000000..cf912ac56
--- /dev/null
+++ b/kdemm/test/statetest.h
@@ -0,0 +1,57 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+
+#include
+
+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
diff --git a/kdemm/test/testwidget.cpp b/kdemm/test/testwidget.cpp
new file mode 100644
index 000000000..a9a579cd1
--- /dev/null
+++ b/kdemm/test/testwidget.cpp
@@ -0,0 +1,194 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+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
diff --git a/kdemm/test/testwidget.h b/kdemm/test/testwidget.h
new file mode 100644
index 000000000..7a9d0df72
--- /dev/null
+++ b/kdemm/test/testwidget.h
@@ -0,0 +1,64 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+
+#include
+
+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
diff --git a/kdemm/videoplayer.cpp b/kdemm/videoplayer.cpp
new file mode 100644
index 000000000..e11705204
--- /dev/null
+++ b/kdemm/videoplayer.cpp
@@ -0,0 +1,34 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
diff --git a/kdemm/videoplayer.h b/kdemm/videoplayer.h
new file mode 100644
index 000000000..3bf26eba0
--- /dev/null
+++ b/kdemm/videoplayer.h
@@ -0,0 +1,54 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
diff --git a/kdemm/volumecontrold/Makefile.am b/kdemm/volumecontrold/Makefile.am
new file mode 100644
index 000000000..b7c7ca729
--- /dev/null
+++ b/kdemm/volumecontrold/Makefile.am
@@ -0,0 +1,31 @@
+# This file is part of the KDE project
+# Copyright (C) 2004 Matthias Kretz
+
+# 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
diff --git a/kdemm/volumecontrold/volumecontrold.cpp b/kdemm/volumecontrold/volumecontrold.cpp
new file mode 100644
index 000000000..41fbc40fd
--- /dev/null
+++ b/kdemm/volumecontrold/volumecontrold.cpp
@@ -0,0 +1,47 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+
+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
diff --git a/kdemm/volumecontrold/volumecontrold.desktop b/kdemm/volumecontrold/volumecontrold.desktop
new file mode 100644
index 000000000..8c0bde15f
--- /dev/null
+++ b/kdemm/volumecontrold/volumecontrold.desktop
@@ -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
diff --git a/kdemm/volumecontrold/volumecontrold.h b/kdemm/volumecontrold/volumecontrold.h
new file mode 100644
index 000000000..709323c47
--- /dev/null
+++ b/kdemm/volumecontrold/volumecontrold.h
@@ -0,0 +1,53 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Matthias Kretz
+
+ 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
+#include
+
+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
diff --git a/kdeprint/cups/cupsdconf2/cupsddialog.cpp b/kdeprint/cups/cupsdconf2/cupsddialog.cpp
index 77f35e1e3..8023aeef7 100644
--- a/kdeprint/cups/cupsdconf2/cupsddialog.cpp
+++ b/kdeprint/cups/cupsdconf2/cupsddialog.cpp
@@ -45,6 +45,7 @@
#include
#include
+#include
#include
#include
diff --git a/kdeprint/cups/kmcupsmanager.cpp b/kdeprint/cups/kmcupsmanager.cpp
index 63513ba55..2d923a371 100644
--- a/kdeprint/cups/kmcupsmanager.cpp
+++ b/kdeprint/cups/kmcupsmanager.cpp
@@ -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()
diff --git a/kdeprint/kmvirtualmanager.cpp b/kdeprint/kmvirtualmanager.cpp
index a6e263faf..268da3eac 100644
--- a/kdeprint/kmvirtualmanager.cpp
+++ b/kdeprint/kmvirtualmanager.cpp
@@ -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);
diff --git a/kdeprint/kprintpreview.cpp b/kdeprint/kprintpreview.cpp
index ab669ea6e..5ad8a428f 100644
--- a/kdeprint/kprintpreview.cpp
+++ b/kdeprint/kprintpreview.cpp
@@ -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)
{
diff --git a/kdeprint/management/smbview.cpp b/kdeprint/management/smbview.cpp
index 127a42e76..08f8487f7 100644
--- a/kdeprint/management/smbview.cpp
+++ b/kdeprint/management/smbview.cpp
@@ -184,16 +184,26 @@ void SmbView::setOpen(TQListViewItem *item, bool on)
}
else if (item->depth() == 1)
{ // opening server
+ char *krb5ccname = getenv ("KRB5CCNAME");
m_current = item;
- *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)
- {
+ 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 (!krb5ccname)
+ {
*m_proc << " -A ";
- *m_proc << KProcess::quote(m_passwdFile->name());
- }
+ *m_proc << KProcess::
+ quote (m_passwdFile->name ());
+ }
startProcess(ShareListing);
}
}
diff --git a/kdesu/defaults.h b/kdesu/defaults.h
index 7610985c2..668cdd02f 100644
--- a/kdesu/defaults.h
+++ b/kdesu/defaults.h
@@ -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
diff --git a/kdeui/Makefile.am b/kdeui/Makefile.am
index 4d60c273b..e5ef761be 100644
--- a/kdeui/Makefile.am
+++ b/kdeui/Makefile.am
@@ -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
diff --git a/kdeui/kaction.cpp b/kdeui/kaction.cpp
index ffc957658..233fd1039 100644
--- a/kdeui/kaction.cpp
+++ b/kdeui/kaction.cpp
@@ -42,6 +42,17 @@
#include
#include
+#include
+#include FT_FREETYPE_H
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
/**
* How it works.
* KActionCollection is an organizing container for KActions.
diff --git a/kdeui/kactionclasses.cpp b/kdeui/kactionclasses.cpp
index 1fa7223cb..113ef2ea0 100644
--- a/kdeui/kactionclasses.cpp
+++ b/kdeui/kactionclasses.cpp
@@ -27,6 +27,9 @@
#include "kactionclasses.h"
#include
+#include
+#include FT_FREETYPE_H
+#include
#include
#include
@@ -35,6 +38,7 @@
#include
#include
#include
+#include
#include
#include
@@ -1498,7 +1502,24 @@ void KFontAction::setFont( const TQString &family )
return;
}
}
- kdDebug(129) << "Font not found " << family.lower() << endl;
+
+ // 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;
}
int KFontAction::plug( TQWidget *w, int index )
diff --git a/kdeui/kcombobox.cpp b/kdeui/kcombobox.cpp
index 31f14ed0f..c3cc4c402 100644
--- a/kdeui/kcombobox.cpp
+++ b/kdeui/kcombobox.cpp
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -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"
diff --git a/kdeui/kcombobox.h b/kdeui/kcombobox.h
index 4a9c30b14..d7d07e4b6 100644
--- a/kdeui/kcombobox.h
+++ b/kdeui/kcombobox.h
@@ -24,8 +24,15 @@
#include
#include
+#include
+#include
+#include
+#include
+#include
#include
+#include
+#include
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
diff --git a/kdeui/kfontcombo.cpp b/kdeui/kfontcombo.cpp
index 4752a0bd1..ea123c38a 100644
--- a/kdeui/kfontcombo.cpp
+++ b/kdeui/kfontcombo.cpp
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
@@ -29,6 +30,18 @@
#include "kfontcombo.h"
#include "kfontcombo.moc"
+#include
+#include FT_FREETYPE_H
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+
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 )
diff --git a/kdeui/kjanuswidget.cpp b/kdeui/kjanuswidget.cpp
index f8647fb26..7f34dc5c1 100644
--- a/kdeui/kjanuswidget.cpp
+++ b/kdeui/kjanuswidget.cpp
@@ -49,16 +49,19 @@ class KJanusWidget::IconListItem : public QListBoxItem
{
public:
IconListItem( TQListBox *listbox, const TQPixmap &pixmap,
- const TQString &text );
+ const TQString &text );
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 );
@@ -259,7 +264,7 @@ void KJanusWidget::slotReopen( TQListViewItem * item )
}
TQFrame *KJanusWidget::addPage( const TQString &itemName, const TQString &header,
- const TQPixmap &pixmap )
+ const TQPixmap &pixmap )
{
TQStringList items;
items << itemName;
@@ -269,8 +274,8 @@ TQFrame *KJanusWidget::addPage( const TQString &itemName, const TQString &header
TQVBox *KJanusWidget::addVBoxPage( const TQStringList &items,
- const TQString &header,
- const TQPixmap &pixmap )
+ const TQString &header,
+ const TQPixmap &pixmap )
{
if( !mValid )
{
@@ -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 );
- 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))
diff --git a/kdeui/kjanuswidget.h b/kdeui/kjanuswidget.h
index 29bfd0462..cc22dc334 100644
--- a/kdeui/kjanuswidget.h
+++ b/kdeui/kjanuswidget.h
@@ -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);
diff --git a/kdeui/kpassdlg.cpp b/kdeui/kpassdlg.cpp
index 8a2d54989..11db31eb5 100644
--- a/kdeui/kpassdlg.cpp
+++ b/kdeui/kpassdlg.cpp
@@ -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);
diff --git a/kdeui/ksconfig.cpp b/kdeui/ksconfig.cpp
index ec5460ed7..a8849e8fe 100644
--- a/kdeui/ksconfig.cpp
+++ b/kdeui/ksconfig.cpp
@@ -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;
diff --git a/kdeui/ksyntaxhighlighter.cpp b/kdeui/ksyntaxhighlighter.cpp
index c70cd672e..a5485841f 100644
--- a/kdeui/ksyntaxhighlighter.cpp
+++ b/kdeui/ksyntaxhighlighter.cpp
@@ -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;
diff --git a/kdeui/ktip.cpp b/kdeui/ktip.cpp
index 778d5e33b..ae619a173 100644
--- a/kdeui/ktip.cpp
+++ b/kdeui/ktip.cpp
@@ -367,24 +367,47 @@ void KTipDialog::showMultiTip(TQWidget *parent, const TQStringList &tipFiles, bo
mInstance->raise();
}
+static TQString fixTip(TQString tip)
+{
+ TQRegExp iconRegExp("");
+ 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(
"%3")
.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("%3")
+ TQString currentTip = TQString::fromLatin1(
+ "%3")
.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);
}
diff --git a/kdeui/qxembed.cpp b/kdeui/qxembed.cpp
index 6403f9d8a..7ec1db3a2 100644
--- a/kdeui/qxembed.cpp
+++ b/kdeui/qxembed.cpp
@@ -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(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( this ));
WId window = ((QPublicWidget*)topLevelWidget())->topData()->parentWinId;
sendXEmbedMessage( window, XEMBED_REQUEST_FOCUS );
} else {
diff --git a/kdeui/qxembed.h b/kdeui/qxembed.h
index 38aabbd77..3b345554f 100644
--- a/kdeui/qxembed.h
+++ b/kdeui/qxembed.h
@@ -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)
diff --git a/kdoctools/kio_help.cpp b/kdoctools/kio_help.cpp
index 615b01b7e..292c4de13 100644
--- a/kdoctools/kio_help.cpp
+++ b/kdoctools/kio_help.cpp
@@ -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" );
diff --git a/khtml/ecma/xmlhttprequest.cpp b/khtml/ecma/xmlhttprequest.cpp
index d3ebebaec..b20515de7 100644
--- a/khtml/ecma/xmlhttprequest.cpp
+++ b/khtml/ecma/xmlhttprequest.cpp
@@ -342,16 +342,16 @@ void XMLHttpRequest::send(const TQString& _body)
{
aborted = false;
- if (method == "post") {
- TQString protocol = url.protocol().lower();
+ 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;
+ }
- // Abondon the request when the protocol is other than "http",
- // instead of blindly changing it to a "get" request.
- if (!protocol.startsWith("http") && !protocol.startsWith("webdav"))
- {
- abort();
- return;
- }
+ if (method == "post") {
// FIXME: determine post encoding correctly by looking in headers
// for charset.
@@ -763,11 +763,11 @@ Value XMLHttpRequestProtoFunc::tryCall(ExecState *exec, Object &thisObj, const L
if (obj.isValid() && obj.inherits(&DOMDocument::info)) {
DOM::Node docNode = static_cast(obj.imp())->toNode();
DOM::DocumentImpl *doc = static_cast(docNode.handle());
-
+
try {
body = doc->toString().string();
// FIXME: also need to set content type, including encoding!
-
+
} catch(DOM::DOMException& e) {
Object err = Error::create(exec, GeneralError, "Exception serializing document");
exec->setException(err);
diff --git a/khtml/khtmlview.cpp b/khtml/khtmlview.cpp
index 7f800a670..850d8e9cd 100644
--- a/khtml/khtmlview.cpp
+++ b/khtml/khtmlview.cpp
@@ -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;
+ {
+ 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
diff --git a/khtml/khtmlview.h b/khtml/khtmlview.h
index 1efb347a6..a79eff17f 100644
--- a/khtml/khtmlview.h
+++ b/khtml/khtmlview.h
@@ -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;
diff --git a/khtml/rendering/render_form.cpp b/khtml/rendering/render_form.cpp
index 403295a8f..58a9a8d33 100644
--- a/khtml/rendering/render_form.cpp
+++ b/khtml/rendering/render_form.cpp
@@ -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))
diff --git a/khtml/rendering/render_form.h b/khtml/rendering/render_form.h
index 33a31a910..c414e079c 100644
--- a/khtml/rendering/render_form.h
+++ b/khtml/rendering/render_form.h
@@ -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;
diff --git a/kinit/autostart.cpp b/kinit/autostart.cpp
index 41caf99f7..63622e737 100644
--- a/kinit/autostart.cpp
+++ b/kinit/autostart.cpp
@@ -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;
diff --git a/kinit/lnusertemp.c b/kinit/lnusertemp.c
index 867f1fb95..fdbf8ae0b 100644
--- a/kinit/lnusertemp.c
+++ b/kinit/lnusertemp.c
@@ -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 (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
+
+ 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
{
- perror("Aborting. Could not determine hostname: ");
- exit(255);
+ if (gethostname(kde_tmp_dir+strlen(kde_tmp_dir), PATH_MAX - strlen(kde_tmp_dir) - 1) != 0)
+ {
+ 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);
diff --git a/kinit/wrapper.c b/kinit/wrapper.c
index 27d208376..7e08d49ca 100644
--- a/kinit/wrapper.c
+++ b/kinit/wrapper.c
@@ -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;
diff --git a/kio/kfile/kfiledialog.cpp b/kio/kfile/kfiledialog.cpp
index f206a4887..0c9364943 100644
--- a/kio/kfile/kfiledialog.cpp
+++ b/kio/kfile/kfiledialog.cpp
@@ -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 )
diff --git a/kio/kfile/kfilesharedlg.cpp b/kio/kfile/kfilesharedlg.cpp
index 788edee51..329bd19dc 100644
--- a/kio/kfile/kfilesharedlg.cpp
+++ b/kio/kfile/kfilesharedlg.cpp
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -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
diff --git a/kio/kfile/kfilesharedlg.h b/kio/kfile/kfilesharedlg.h
index 25fbc7f67..54876f12a 100644
--- a/kio/kfile/kfilesharedlg.h
+++ b/kio/kfile/kfilesharedlg.h
@@ -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;
diff --git a/kio/kfile/kurlbar.cpp b/kio/kfile/kurlbar.cpp
index 5c2b167c0..08dd36656 100644
--- a/kio/kfile/kurlbar.cpp
+++ b/kio/kfile/kurlbar.cpp
@@ -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(
diff --git a/kio/kio/kdirwatch.cpp b/kio/kio/kdirwatch.cpp
index 08ab25b89..38cd8f866 100644
--- a/kio/kio/kdirwatch.cpp
+++ b/kio/kio/kdirwatch.cpp
@@ -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);
diff --git a/kio/kio/kfileshare.cpp b/kio/kio/kfileshare.cpp
index 6b9bf361d..1f6dca285 100644
--- a/kio/kio/kfileshare.cpp
+++ b/kio/kio/kfileshare.cpp
@@ -20,6 +20,7 @@
#include "kfileshare.h"
#include
#include
+#include
#include
#include
#include
@@ -35,8 +36,10 @@
#include
KFileShare::Authorization KFileShare::s_authorization = NotInitialized;
-TQStringList* KFileShare::s_shareList = 0L;
-static KStaticDeleter sdShareList;
+//TQStringList* KFileShare::s_shareList = 0L;
+//static KStaticDeleter sdShareList;
+TQMap* KFileShare::s_shareMap = 0L;
+static KStaticDeleter > 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 );
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"
diff --git a/kio/kio/kfileshare.h b/kio/kio/kfileshare.h
index 6753e055a..6fddebd65 100644
--- a/kio/kio/kfileshare.h
+++ b/kio/kio/kfileshare.h
@@ -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 };
/**
@@ -85,7 +85,12 @@ public:
* @returns whether the perl script was successful
*/
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
@@ -131,10 +136,23 @@ public:
* Returns whether NFS is enabled
*/
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* s_shareMap;
static ShareMode s_shareMode;
static bool s_sambaEnabled;
static bool s_nfsEnabled;
diff --git a/kio/kio/kmimetype.cpp b/kio/kio/kmimetype.cpp
index af4243a53..a698e7495 100644
--- a/kio/kio/kmimetype.cpp
+++ b/kio/kio/kmimetype.cpp
@@ -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 );
diff --git a/kio/kio/kremoteencoding.cpp b/kio/kio/kremoteencoding.cpp
index ebd7fda74..632eeb8b2 100644
--- a/kio/kio/kremoteencoding.cpp
+++ b/kio/kio/kremoteencoding.cpp
@@ -53,7 +53,7 @@ TQCString KRemoteEncoding::encode(const TQString& name) const
TQCString result = codec->fromUnicode(name);
if (codec->toUnicode(result) != name)
return name.latin1();
-
+
return result;
}
@@ -80,11 +80,13 @@ 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);
- kdDebug() << k_funcinfo << "setting encoding " << codec->name()
+ kdDebug() << k_funcinfo << "setting encoding " << codec->name()
<< " for name=" << name << endl;
}
diff --git a/kio/kio/kservice.cpp b/kio/kio/kservice.cpp
index 2122010b2..299d91e90 100644
--- a/kio/kio/kservice.cpp
+++ b/kio/kio/kservice.cpp
@@ -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,7 +275,10 @@ KService::init( KDesktopFile *config )
m_bAllowAsDefault = config->readBoolEntry( "AllowDefault", true );
entryMap.remove("AllowDefault");
- m_initialPreference = config->readNumEntry( "InitialPreference", 1 );
+ 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");
// Store all additional entries in the property map.
diff --git a/kio/kio/kservicegroup.cpp b/kio/kio/kservicegroup.cpp
index 1531dc796..be093fc17 100644
--- a/kio/kio/kservicegroup.cpp
+++ b/kio/kio/kservicegroup.cpp
@@ -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;
diff --git a/kio/kio/netaccess.cpp b/kio/kio/netaccess.cpp
index 1c54afa74..5189b93d6 100644
--- a/kio/kio/netaccess.cpp
+++ b/kio/kio/netaccess.cpp
@@ -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 );
diff --git a/kio/kssl/kopenssl.cc b/kio/kssl/kopenssl.cc
index 9252bd223..ababf37a0 100644
--- a/kio/kssl/kopenssl.cc
+++ b/kio/kssl/kopenssl.cc
@@ -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);
diff --git a/kio/kssl/kopenssl.h b/kio/kssl/kopenssl.h
index 68d6733cd..e4f6de0e8 100644
--- a/kio/kssl/kopenssl.h
+++ b/kio/kssl/kopenssl.h
@@ -48,6 +48,9 @@ class KOpenSSLProxyPrivate;
#include
#include
#undef crypt
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+#define STACK _STACK
+#endif
#endif
#include
@@ -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(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(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(s), reinterpret_cast(d)); }
+#endif
/*
* Duplicate the stack
diff --git a/kio/kssl/ksmimecrypto.cc b/kio/kssl/ksmimecrypto.cc
index c96f9ec6d..1a9e37e60 100644
--- a/kio/kssl/ksmimecrypto.cc
+++ b/kio/kssl/ksmimecrypto.cc
@@ -87,7 +87,7 @@ KSMIMECryptoPrivate::KSMIMECryptoPrivate(KOpenSSLProxy *kossl): kossl(kossl) {
STACK_OF(X509) *KSMIMECryptoPrivate::certsToX509(TQPtrList &certs) {
- STACK_OF(X509) *x509 = sk_new(NULL);
+ STACK_OF(X509) *x509 = reinterpret_cast(sk_new(NULL));
KSSLCertificate *cert = certs.first();
while(cert) {
sk_X509_push(x509, cert->getCert());
diff --git a/kio/kssl/ksslcertificate.cc b/kio/kssl/ksslcertificate.cc
index a76b235d7..73a8451ca 100644
--- a/kio/kssl/ksslcertificate.cc
+++ b/kio/kssl/ksslcertificate.cc
@@ -1003,17 +1003,31 @@ return qba;
TQByteArray KSSLCertificate::toNetscape() {
TQByteArray qba;
#ifdef KSSL_HAVE_SSL
-ASN1_HEADER ah;
-ASN1_OCTET_STRING os;
-KTempFile ktf;
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ NETSCAPE_X509 nx;
+ ASN1_OCTET_STRING hdr;
+#else
+ ASN1_HEADER ah;
+ ASN1_OCTET_STRING os;
+#endif
+ KTempFile ktf;
- os.data = (unsigned char *)NETSCAPE_CERT_HDR;
- os.length = strlen(NETSCAPE_CERT_HDR);
- ah.header = &os;
- ah.data = (char *)getCert();
- ah.meth = d->kossl->X509_asn1_meth();
+#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 *)&ah);
+ 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;
+ ah.data = (char *)getCert();
+ ah.meth = d->kossl->X509_asn1_meth();
+
+ d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&ah);
+#endif
ktf.close();
diff --git a/kio/misc/kwalletd/kwalletd.cpp b/kio/misc/kwalletd/kwalletd.cpp
index fd39f8487..069575710 100644
--- a/kio/misc/kwalletd/kwalletd.cpp
+++ b/kio/misc/kwalletd/kwalletd.cpp
@@ -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;
diff --git a/kio/misc/kwalletd/kwalletd.h b/kio/misc/kwalletd/kwalletd.h
index b426e7d5a..2aea371ba 100644
--- a/kio/misc/kwalletd/kwalletd.h
+++ b/kio/misc/kwalletd/kwalletd.h
@@ -26,6 +26,7 @@
#include
#include
#include
+#include
#include
#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 _implicitAllowMap, _implicitDenyMap;
KTimeout *_timeouts;
+ TQTimer _tryOpenBlocked;
TQPtrList _transactions;
TQGuardedPtr< TQWidget > activeDialog;
diff --git a/kioslave/file/Makefile.am b/kioslave/file/Makefile.am
index 7cafcb339..0f26c723a 100644
--- a/kioslave/file/Makefile.am
+++ b/kioslave/file/Makefile.am
@@ -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
diff --git a/kioslave/file/file.cc b/kioslave/file/file.cc
index 1fde27a81..441d03b98 100644
--- a/kioslave/file/file.cc
+++ b/kioslave/file/file.cc
@@ -69,6 +69,7 @@
#include
#include
+#include
#include
#include
#include
@@ -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
diff --git a/kioslave/ftp/ftp.cc b/kioslave/ftp/ftp.cc
index ffc324c39..9e4fc21d9 100644
--- a/kioslave/ftp/ftp.cc
+++ b/kioslave/ftp/ftp.cc
@@ -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
diff --git a/kioslave/ftp/ftp.h b/kioslave/ftp/ftp.h
index b2ce56492..44f0bdc71 100644
--- a/kioslave/ftp/ftp.h
+++ b/kioslave/ftp/ftp.h
@@ -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
*/
diff --git a/kresources/kresources.desktop b/kresources/kresources.desktop
index 6c7739bdc..ec30b3885 100644
--- a/kresources/kresources.desktop
+++ b/kresources/kresources.desktop
@@ -1,6 +1,6 @@
[Desktop Entry]
Exec=kcmshell kresources
-Icon=date
+Icon=about_kde
Type=Application
Terminal=false
diff --git a/mimetypes/application/ogg.desktop b/mimetypes/application/ogg.desktop
index bf3f8bf10..be94dfaa7 100644
--- a/mimetypes/application/ogg.desktop
+++ b/mimetypes/application/ogg.desktop
@@ -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
diff --git a/mimetypes/application/vnd.oasis.opendocument.formula.desktop b/mimetypes/application/vnd.oasis.opendocument.formula.desktop
index 3f3bb95eb..4f61a49f4 100644
--- a/mimetypes/application/vnd.oasis.opendocument.formula.desktop
+++ b/mimetypes/application/vnd.oasis.opendocument.formula.desktop
@@ -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
diff --git a/mimetypes/application/vnd.sun.xml.base.desktop b/mimetypes/application/vnd.sun.xml.base.desktop
index 4b4aa7425..581456933 100644
--- a/mimetypes/application/vnd.sun.xml.base.desktop
+++ b/mimetypes/application/vnd.sun.xml.base.desktop
@@ -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
diff --git a/mimetypes/application/x-bittorrent.desktop b/mimetypes/application/x-bittorrent.desktop
index 9981ef65b..4c166a114 100644
--- a/mimetypes/application/x-bittorrent.desktop
+++ b/mimetypes/application/x-bittorrent.desktop
@@ -1,4 +1,5 @@
[Desktop Entry]
+Icon=torrent
Comment=BitTorrent Download
Comment[af]=BitTorrent Aflaai
Comment[ar]=ملف تنزيل BitTorrent
diff --git a/mimetypes/application/x-msdos-program.desktop b/mimetypes/application/x-msdos-program.desktop
index 508cc737e..5d380bf9a 100644
--- a/mimetypes/application/x-msdos-program.desktop
+++ b/mimetypes/application/x-msdos-program.desktop
@@ -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
diff --git a/mimetypes/application/x-ogg.desktop b/mimetypes/application/x-ogg.desktop
index c91a8400f..e96d9af3c 100644
--- a/mimetypes/application/x-ogg.desktop
+++ b/mimetypes/application/x-ogg.desktop
@@ -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
diff --git a/mimetypes/application/x-rpm.desktop b/mimetypes/application/x-rpm.desktop
index 38af4822f..399c97a1f 100644
--- a/mimetypes/application/x-rpm.desktop
+++ b/mimetypes/application/x-rpm.desktop
@@ -1,4 +1,5 @@
[Desktop Entry]
+X-KDE-AutoEmbed=true
Type=MimeType
MimeType=application/x-rpm
Icon=rpm
diff --git a/mimetypes/text/rtf.desktop b/mimetypes/text/rtf.desktop
index 93582979a..0fa173e8c 100644
--- a/mimetypes/text/rtf.desktop
+++ b/mimetypes/text/rtf.desktop
@@ -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]
diff --git a/pics/crystalsvg/cr128-mime-database.png b/pics/crystalsvg/cr128-mime-database.png
new file mode 100644
index 000000000..54a9f6484
Binary files /dev/null and b/pics/crystalsvg/cr128-mime-database.png differ
diff --git a/pics/crystalsvg/cr128-mime-drawing.png b/pics/crystalsvg/cr128-mime-drawing.png
new file mode 100644
index 000000000..daebcc5d6
Binary files /dev/null and b/pics/crystalsvg/cr128-mime-drawing.png differ
diff --git a/pics/crystalsvg/cr128-mime-presentation.png b/pics/crystalsvg/cr128-mime-presentation.png
new file mode 100644
index 000000000..c66f732c9
Binary files /dev/null and b/pics/crystalsvg/cr128-mime-presentation.png differ
diff --git a/pics/crystalsvg/cr128-mime-rtf.png b/pics/crystalsvg/cr128-mime-rtf.png
new file mode 100644
index 000000000..fd77cc495
Binary files /dev/null and b/pics/crystalsvg/cr128-mime-rtf.png differ
diff --git a/pics/crystalsvg/cr16-mime-database.png b/pics/crystalsvg/cr16-mime-database.png
new file mode 100644
index 000000000..94f36bbc2
Binary files /dev/null and b/pics/crystalsvg/cr16-mime-database.png differ
diff --git a/pics/crystalsvg/cr16-mime-drawing.png b/pics/crystalsvg/cr16-mime-drawing.png
new file mode 100644
index 000000000..acce3537b
Binary files /dev/null and b/pics/crystalsvg/cr16-mime-drawing.png differ
diff --git a/pics/crystalsvg/cr16-mime-presentation.png b/pics/crystalsvg/cr16-mime-presentation.png
new file mode 100644
index 000000000..f0abdec2a
Binary files /dev/null and b/pics/crystalsvg/cr16-mime-presentation.png differ
diff --git a/pics/crystalsvg/cr16-mime-rtf.png b/pics/crystalsvg/cr16-mime-rtf.png
new file mode 100644
index 000000000..d2bed0b59
Binary files /dev/null and b/pics/crystalsvg/cr16-mime-rtf.png differ
diff --git a/pics/crystalsvg/cr22-mime-database.png b/pics/crystalsvg/cr22-mime-database.png
new file mode 100644
index 000000000..a9f512c41
Binary files /dev/null and b/pics/crystalsvg/cr22-mime-database.png differ
diff --git a/pics/crystalsvg/cr22-mime-drawing.png b/pics/crystalsvg/cr22-mime-drawing.png
new file mode 100644
index 000000000..f4fa2a87f
Binary files /dev/null and b/pics/crystalsvg/cr22-mime-drawing.png differ
diff --git a/pics/crystalsvg/cr22-mime-presentation.png b/pics/crystalsvg/cr22-mime-presentation.png
new file mode 100644
index 000000000..d82330f48
Binary files /dev/null and b/pics/crystalsvg/cr22-mime-presentation.png differ
diff --git a/pics/crystalsvg/cr22-mime-rtf.png b/pics/crystalsvg/cr22-mime-rtf.png
new file mode 100644
index 000000000..6a5c95b98
Binary files /dev/null and b/pics/crystalsvg/cr22-mime-rtf.png differ
diff --git a/pics/crystalsvg/cr32-mime-database.png b/pics/crystalsvg/cr32-mime-database.png
new file mode 100644
index 000000000..b4752d6fb
Binary files /dev/null and b/pics/crystalsvg/cr32-mime-database.png differ
diff --git a/pics/crystalsvg/cr32-mime-drawing.png b/pics/crystalsvg/cr32-mime-drawing.png
new file mode 100644
index 000000000..b35b4d559
Binary files /dev/null and b/pics/crystalsvg/cr32-mime-drawing.png differ
diff --git a/pics/crystalsvg/cr32-mime-presentation.png b/pics/crystalsvg/cr32-mime-presentation.png
new file mode 100644
index 000000000..8bfc7b771
Binary files /dev/null and b/pics/crystalsvg/cr32-mime-presentation.png differ
diff --git a/pics/crystalsvg/cr32-mime-rtf.png b/pics/crystalsvg/cr32-mime-rtf.png
new file mode 100644
index 000000000..f25dd9527
Binary files /dev/null and b/pics/crystalsvg/cr32-mime-rtf.png differ
diff --git a/pics/crystalsvg/cr48-mime-database.png b/pics/crystalsvg/cr48-mime-database.png
new file mode 100644
index 000000000..517ae3c48
Binary files /dev/null and b/pics/crystalsvg/cr48-mime-database.png differ
diff --git a/pics/crystalsvg/cr48-mime-drawing.png b/pics/crystalsvg/cr48-mime-drawing.png
new file mode 100644
index 000000000..ad7a9cd0c
Binary files /dev/null and b/pics/crystalsvg/cr48-mime-drawing.png differ
diff --git a/pics/crystalsvg/cr48-mime-presentation.png b/pics/crystalsvg/cr48-mime-presentation.png
new file mode 100644
index 000000000..f2a50c933
Binary files /dev/null and b/pics/crystalsvg/cr48-mime-presentation.png differ
diff --git a/pics/crystalsvg/cr48-mime-rtf.png b/pics/crystalsvg/cr48-mime-rtf.png
new file mode 100644
index 000000000..2fe6e7c87
Binary files /dev/null and b/pics/crystalsvg/cr48-mime-rtf.png differ
diff --git a/pics/crystalsvg/cr64-mime-database.png b/pics/crystalsvg/cr64-mime-database.png
new file mode 100644
index 000000000..bca874a2b
Binary files /dev/null and b/pics/crystalsvg/cr64-mime-database.png differ
diff --git a/pics/crystalsvg/cr64-mime-drawing.png b/pics/crystalsvg/cr64-mime-drawing.png
new file mode 100644
index 000000000..451395f9c
Binary files /dev/null and b/pics/crystalsvg/cr64-mime-drawing.png differ
diff --git a/pics/crystalsvg/cr64-mime-presentation.png b/pics/crystalsvg/cr64-mime-presentation.png
new file mode 100644
index 000000000..d00656fe4
Binary files /dev/null and b/pics/crystalsvg/cr64-mime-presentation.png differ
diff --git a/pics/crystalsvg/cr64-mime-rtf.png b/pics/crystalsvg/cr64-mime-rtf.png
new file mode 100644
index 000000000..29ced93d1
Binary files /dev/null and b/pics/crystalsvg/cr64-mime-rtf.png differ
diff --git a/pics/crystalsvg/crsc-mime-database.svgz b/pics/crystalsvg/crsc-mime-database.svgz
new file mode 100644
index 000000000..579447bcf
Binary files /dev/null and b/pics/crystalsvg/crsc-mime-database.svgz differ
diff --git a/pics/crystalsvg/crsc-mime-drawing.svgz b/pics/crystalsvg/crsc-mime-drawing.svgz
new file mode 100644
index 000000000..2a690f03f
Binary files /dev/null and b/pics/crystalsvg/crsc-mime-drawing.svgz differ
diff --git a/pics/crystalsvg/crsc-mime-presentation.svgz b/pics/crystalsvg/crsc-mime-presentation.svgz
new file mode 100644
index 000000000..f2874b1ac
Binary files /dev/null and b/pics/crystalsvg/crsc-mime-presentation.svgz differ
diff --git a/pics/crystalsvg/crsc-mime-rtf.svgz b/pics/crystalsvg/crsc-mime-rtf.svgz
new file mode 100644
index 000000000..923cf5623
Binary files /dev/null and b/pics/crystalsvg/crsc-mime-rtf.svgz differ