From dfe289850f068f19ba4a83ab4e7e22a7e09c13c9 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 26 Jan 2013 13:17:21 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- kio/tests/Makefile.am | 18 +- kio/tests/kdirwatchunittest.cpp | 2 +- kio/tests/kdirwatchunittest.h | 4 +- kio/tests/ksycocatest.cpp | 360 -------------------------------------- kio/tests/ksycocaupdatetest.cpp | 11 -- kio/tests/kurifiltertest.cpp | 2 +- kio/tests/tdesycocatest.cpp | 360 ++++++++++++++++++++++++++++++++++++++ kio/tests/tdesycocaupdatetest.cpp | 11 ++ 8 files changed, 384 insertions(+), 384 deletions(-) delete mode 100644 kio/tests/ksycocatest.cpp delete mode 100644 kio/tests/ksycocaupdatetest.cpp create mode 100644 kio/tests/tdesycocatest.cpp create mode 100644 kio/tests/tdesycocaupdatetest.cpp (limited to 'kio/tests') diff --git a/kio/tests/Makefile.am b/kio/tests/Makefile.am index fe0b6d7ca..3a81dfc57 100644 --- a/kio/tests/Makefile.am +++ b/kio/tests/Makefile.am @@ -18,15 +18,15 @@ INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/kio $(all_includes) LDADD = $(LIB_KIO) -AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor +AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor -check_PROGRAMS = ksycocatest getalltest kruntest ktartest kziptest\ +check_PROGRAMS = tdesycocatest getalltest kruntest ktartest kziptest\ kioslavetest kdirwatchtest kshredtest speed kurifiltertest \ kdefaultprogresstest kmimemagictest \ kfiltertest kiopassdlgtest kscantest kdirlistertest \ previewtest kionetrctest kdcopcheck metatest \ kmimefromext kpropsdlgtest kmfitest dataprotocoltest \ - kprotocolinfotest ksycocaupdatetest netaccesstest jobtest \ + kprotocolinfotest tdesycocaupdatetest netaccesstest jobtest \ kurlcompletiontest kmimetypetest kacltest # Unfortunately some tests depend on the network settings, it seems @@ -48,7 +48,7 @@ kdefaultprogresstest_SOURCES = kdefaultprogresstest.cpp kionetrctest_SOURCES = kionetrctest.cpp kiopassdlgtest_SOURCES = kiopassdlgtest.cpp kurifiltertest_SOURCES = kurifiltertest.cpp -ksycocatest_SOURCES = ksycocatest.cpp +tdesycocatest_SOURCES = tdesycocatest.cpp kdcopcheck_SOURCES = kdcopcheck.cpp getalltest_SOURCES = getalltest.cpp kruntest_SOURCES = kruntest.cpp @@ -67,7 +67,7 @@ kpropsdlgtest_SOURCES = kpropsdlgtest.cpp kmfitest_SOURCES = kmfitest.cpp dataprotocoltest_SOURCES = dataprotocoltest.cpp kprotocolinfotest_SOURCES = kprotocolinfotest.cpp -ksycocaupdatetest_SOURCES = ksycocaupdatetest.cpp +tdesycocaupdatetest_SOURCES = tdesycocaupdatetest.cpp netaccesstest_SOURCES = netaccesstest.cpp jobtest_SOURCES = jobtest.cpp kurlcompletiontest_SOURCES = kurlcompletiontest.cpp @@ -75,10 +75,10 @@ kmimetypetest_SOURCES = kmimetypetest.cpp kacltest_SOURCES = kacltest.cpp -check_LTLIBRARIES = kunittest_kdirwatch.la -kunittest_kdirwatch_la_SOURCES = kdirwatchunittest.cpp -kunittest_kdirwatch_la_LIBADD = $(LIB_KUNITTEST) $(LIB_KIO) -kunittest_kdirwatch_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) +check_LTLIBRARIES = tdeunittest_kdirwatch.la +tdeunittest_kdirwatch_la_SOURCES = kdirwatchunittest.cpp +tdeunittest_kdirwatch_la_LIBADD = $(LIB_KUNITTEST) $(LIB_KIO) +tdeunittest_kdirwatch_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) # kfile meta stuff. Comment this in, if you want a small # metadata plugin test and "make install". diff --git a/kio/tests/kdirwatchunittest.cpp b/kio/tests/kdirwatchunittest.cpp index 870b85de9..3d7505a3f 100644 --- a/kio/tests/kdirwatchunittest.cpp +++ b/kio/tests/kdirwatchunittest.cpp @@ -106,7 +106,7 @@ void KDirWatchTest::rename_file(const TQString& from, const TQString& to) ::rename(TQFile::encodeName(from), TQFile::encodeName(to)); } -KUNITTEST_MODULE ( kunittest_kdirwatch, "KDirWatchTest" ) +KUNITTEST_MODULE ( tdeunittest_kdirwatch, "KDirWatchTest" ) KUNITTEST_MODULE_REGISTER_TESTER (KDirWatchTest) #define SLEEP() TQApplication::processEvents(); diff --git a/kio/tests/kdirwatchunittest.h b/kio/tests/kdirwatchunittest.h index 053ab2882..42222a787 100644 --- a/kio/tests/kdirwatchunittest.h +++ b/kio/tests/kdirwatchunittest.h @@ -19,8 +19,8 @@ #include "kdirwatch.h" #include "kapplication.h" -#include -#include +#include +#include class KDirWatchTest : public KUnitTest::Tester { diff --git a/kio/tests/ksycocatest.cpp b/kio/tests/ksycocatest.cpp deleted file mode 100644 index 45f94ac3c..000000000 --- a/kio/tests/ksycocatest.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright (C) 2002, 2003 David Faure - * - * 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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -bool check(TQString txt, TQString a, TQString b) -{ - if (a.isEmpty()) - a = TQString::null; - if (b.isEmpty()) - b = TQString::null; - if (a == b) { - kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; - } - else { - kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl -; - exit(1); - } - return true; -} - -void debug(TQString txt) -{ - fprintf(stderr, "%s\n", txt.ascii()); -} - -void debug(const char *txt) -{ - fprintf(stderr, "%s\n", txt); -} -void debug(const char *format, const char *txt) -{ - fprintf(stderr, format, txt); - fprintf(stderr, "\n"); -} - -int main(int argc, char *argv[]) -{ - TDEApplication k(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption - - TQCString instname = "kword"; - TQString desktopPath = TQString::fromLatin1( "Office/%1.desktop" ).arg( instname ); - tqDebug( "Looking for %s", desktopPath.latin1() ); - KService::Ptr service = KService::serviceByDesktopPath( desktopPath ); - if ( service ) - tqDebug( "found: %s", service->desktopEntryPath().latin1() ); - else - tqDebug( "not found" ); - - tqDebug( "Looking for desktop name = %s", instname.data() ); - service = KService::serviceByDesktopName( instname ); - if ( service ) - tqDebug( "found: %s", service->desktopEntryPath().latin1() ); - else - tqDebug( "not found" ); - - debug("Trying to look for text/plain"); - KMimeType::Ptr s1 = KMimeType::mimeType("text/plain"); - if ( s1 ) - { - debug("Found it !"); - debug(TQString("Comment is %1").arg(s1->comment(KURL(),false))); - } - else - { - debug("Not found !"); - exit(1); - } - - debug("Trying to look for application/x-zerosize"); - KMimeType::Ptr s0 = KMimeType::mimeType("application/x-zerosize"); - if ( s0 ) - { - debug("Found it !"); - debug(TQString("Comment is %1").arg(s0->comment(KURL(),false))); - } - else - { - debug("Not found !"); - exit(1); - } - - debug("Trying to look for Desktop Pager"); - KService::Ptr se = KService::serviceByName("Desktop Pager"); - if ( se ) - { - debug("Found it !"); - debug(TQString("Comment is %1").arg(se->comment())); - } - else - { - debug("Not found !"); - } - - debug("Trying to look for kpager"); - se = KService::serviceByDesktopName("kpager"); - if ( se ) - { - debug("Found it !"); - debug(TQString("Comment is %1").arg(se->comment())); - TQVariant qv = se->property("DocPath"); - debug(TQString("Property type is %1").arg(qv.typeName())); - debug(TQString("Property value is %1").arg(qv.toString())); - } - else - { - debug("Not found !"); - } - - debug("Trying to look for System/kpager.desktop"); - se = KService::serviceByDesktopPath("System/kpager.desktop"); - if ( se ) - { - debug("Found it !"); - debug(TQString("Comment is %1").arg(se->comment())); - } - else - { - debug("Not found !"); - } - - debug("Trying to look for System/fake-entry.desktop"); - se = KService::serviceByDesktopPath("System/fake-entry.desktop"); - if ( se ) - { - debug("Found it !"); - debug(TQString("Comment is %1").arg(se->comment())); - } - else - { - debug("Not found !"); - } - -#if 1 - debug("Querying userprofile for services associated with text/plain"); - KServiceTypeProfile::OfferList offers = KServiceTypeProfile::offers("text/plain"); - debug(TQString("got %1 offers").arg(offers.count())); - KServiceTypeProfile::OfferList::Iterator it = offers.begin(); - for ( ; it != offers.end() ; it++ ) - { - debug((*it).service()->name()); - } - - debug("Querying userprofile for services associated with KOfficeFilter"); - offers = KServiceTypeProfile::offers("KOfficeFilter"); - debug(TQString("got %1 offers").arg(offers.count())); - it = offers.begin(); - for ( ; it != offers.end() ; it++ ) - { - debug((*it).service()->name()); - } - - debug("Querying trader for Konqueror/Plugin"); - KTrader::OfferList traderoffers = KTrader::self()->query("Konqueror/Plugin"); - debug(TQString("got %1 offers").arg(traderoffers.count())); - KTrader::OfferList::Iterator trit = traderoffers.begin(); - for ( ; trit != traderoffers.end() ; trit++ ) - { - debug((*trit)->name()); - } -#endif - - - // - debug("\nTrying findByURL for $TDEDIR/bin/kdesktop"); - KMimeType::Ptr mf = KMimeType::findByURL( KStandardDirs::findExe( "kdesktop" ), 0, - true, false ); - assert( mf ); - check( "A binary's mimetype", mf->name(), "application/x-executable" ); - - // - debug("\nTrying findByURL for folder_home.png"); - TQString fh; - (void)k.iconLoader()->loadIcon("folder_home.png",KIcon::Desktop,0,KIcon::DefaultState,&fh); - mf = KMimeType::findByURL( fh, 0, true, false ); - assert( mf ); - check( "A PNG's mimetype", mf->name(), "image/png" ); - - // - //debug("\nTrying findByURL for Makefile.am"); - //mf = KMimeType::findByURL( KURL("/tmp/Makefile.am"), 0, true, false ); - //assert( mf ); - //debug(TQString("Name is %1").arg(mf->name())); - //debug(TQString("Comment is %1").arg(mf->comment(KURL(),false))); - - debug("\nTrying findByURL for man:/ls"); - mf = KMimeType::findByURL( KURL("man:/ls") ); - assert( mf ); - check( "man:/ls", mf->name(), "text/html" ); - check( "man:/ls/", mf->name(), "text/html" ); - - mf = KMimeType::findByURL( KURL("http://foo/bar.png") ); - check( "HTTP URL", mf->name(), "application/octet-stream" ); // HTTP can't know before downloading - -#if 1 - KMimeType::List mtl; - - mtl = KMimeType::allMimeTypes( ); - assert( mtl.count() ); - debug(TQString("Found %1 mime types.").arg(mtl.count())); - for(int i = 0; i < (int)mtl.count(); i++) - { - debug(TQString("Mime type %1: %2.").arg(i).arg(mtl[i]->name())); - } - - KService::List sl; - - sl = KService::allServices( ); - assert( sl.count() ); - debug(TQString("Found %1 services.").arg(sl.count())); - - KServiceGroup::Ptr root = KServiceGroup::root(); - KServiceGroup::List list = root->entries(); - //KServiceGroup::Ptr topGroup = KServiceGroup::childGroup( "kview" ); - //Q_ASSERT( topGroup ); - //KServiceGroup::List list = topGroup->entries(); - - KServiceGroup::Ptr first; - - debug(TQString("Found %1 entries").arg(list.count())); - for( KServiceGroup::List::ConstIterator it = list.begin(); - it != list.end(); it++) - { - KSycocaEntry *p = (*it); - if (p->isType(KST_KService)) - { - KService *service = static_cast(p); - debug(service->name()); - debug(service->desktopEntryPath()); - } - else if (p->isType(KST_KServiceGroup)) - { - KServiceGroup *serviceGroup = static_cast(p); - debug(TQString(" %1 -->").arg(serviceGroup->caption())); - if (!first) first = serviceGroup; - } - else - { - debug("KServiceGroup: Unexpected object in list!"); - } - } - - if (first) - { - list = first->entries(); - debug(TQString("Found %1 entries").arg(list.count())); - for( KServiceGroup::List::ConstIterator it = list.begin(); - it != list.end(); it++) - { - KSycocaEntry *p = (*it); - if (p->isType(KST_KService)) - { - KService *service = static_cast(p); - debug(TQString(" %1").arg(service->name())); - } - else if (p->isType(KST_KServiceGroup)) - { - KServiceGroup *serviceGroup = static_cast(p); - debug(TQString(" %1 -->").arg(serviceGroup->caption())); - } - else - { - debug("KServiceGroup: Unexpected object in list!"); - } - } - } - - debug("--services that require initialisation--"); - sl = KService::allInitServices(); - for( KService::List::ConstIterator it = sl.begin(); - it != sl.end(); it++) - { - KService *service = static_cast(*it); - debug(service->name()); - } - debug("--End of list--"); - - debug("--protocols--"); - TQStringList stringL = KProtocolInfo::protocols(); - for( TQStringList::ConstIterator it = stringL.begin(); - it != stringL.end(); it++) - { - debug((*it).ascii()); - } - debug("--End of list--"); -#endif - -#if 0 - KImageIO::registerFormats(); - - TQStringList types; - types = KImageIO::types(KImageIO::Reading); - debug("Can read:"); - for(TQStringList::ConstIterator it = types.begin(); - it != types.end(); ++it) - debug(TQString(" %1").arg((*it))); - - types = KImageIO::types(KImageIO::Writing); - debug("Can write:"); - for(TQStringList::ConstIterator it = types.begin(); - it != types.end(); ++it) - debug(TQString(" %1").arg((*it))); - - - TQString rPattern = KImageIO::pattern( KImageIO::Reading ); - debug("Read pattern:\n%s", rPattern.ascii()); - - TQString wPattern = KImageIO::pattern( KImageIO::Writing ); - debug("Write pattern:\n%s", wPattern.ascii()); - - TQString suffix = KImageIO::suffix("JPEG"); - debug("Standard suffix for JPEG: %s", suffix.ascii()); - - types = KImageIO::mimeTypes(KImageIO::Reading); - debug("Can read (mimetypes):"); - for(TQStringList::ConstIterator it = types.begin(); - it != types.end(); ++it) - debug(" %s", (*it).ascii()); - - types = KImageIO::mimeTypes(KImageIO::Writing); - debug("Can write (mimetypes):"); - for(TQStringList::ConstIterator it = types.begin(); - it != types.end(); ++it) - debug(" %s", (*it).ascii()); - - debug("done"); -#endif - return 0; -} diff --git a/kio/tests/ksycocaupdatetest.cpp b/kio/tests/ksycocaupdatetest.cpp deleted file mode 100644 index e7778e056..000000000 --- a/kio/tests/ksycocaupdatetest.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -#include - -int main(int argc, char *argv[]) -{ - TDEApplication k(argc,argv,"whatever"); // KMessageBox needs KApp for makeStdCaption - - KService::rebuildKSycoca(0); - return 0; -} diff --git a/kio/tests/kurifiltertest.cpp b/kio/tests/kurifiltertest.cpp index a5ed8da9d..820f97403 100644 --- a/kio/tests/kurifiltertest.cpp +++ b/kio/tests/kurifiltertest.cpp @@ -154,7 +154,7 @@ static const KCmdLineOptions options[] = int main(int argc, char **argv) { // Ensure that user configuration doesn't change the results of those tests - // TDEHOME needs to be writable though, for a ksycoca database + // TDEHOME needs to be writable though, for a tdesycoca database setenv( "TDEHOME", TQFile::encodeName( TQDir::homeDirPath() + "/.tde-kurifiltertest" ), true ); setenv( "TDE_FORK_SLAVES", "yes", true ); // simpler, for the final cleanup diff --git a/kio/tests/tdesycocatest.cpp b/kio/tests/tdesycocatest.cpp new file mode 100644 index 000000000..45f94ac3c --- /dev/null +++ b/kio/tests/tdesycocatest.cpp @@ -0,0 +1,360 @@ +/* + * Copyright (C) 2002, 2003 David Faure + * + * 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., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +bool check(TQString txt, TQString a, TQString b) +{ + if (a.isEmpty()) + a = TQString::null; + if (b.isEmpty()) + b = TQString::null; + if (a == b) { + kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; + } + else { + kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl +; + exit(1); + } + return true; +} + +void debug(TQString txt) +{ + fprintf(stderr, "%s\n", txt.ascii()); +} + +void debug(const char *txt) +{ + fprintf(stderr, "%s\n", txt); +} +void debug(const char *format, const char *txt) +{ + fprintf(stderr, format, txt); + fprintf(stderr, "\n"); +} + +int main(int argc, char *argv[]) +{ + TDEApplication k(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption + + TQCString instname = "kword"; + TQString desktopPath = TQString::fromLatin1( "Office/%1.desktop" ).arg( instname ); + tqDebug( "Looking for %s", desktopPath.latin1() ); + KService::Ptr service = KService::serviceByDesktopPath( desktopPath ); + if ( service ) + tqDebug( "found: %s", service->desktopEntryPath().latin1() ); + else + tqDebug( "not found" ); + + tqDebug( "Looking for desktop name = %s", instname.data() ); + service = KService::serviceByDesktopName( instname ); + if ( service ) + tqDebug( "found: %s", service->desktopEntryPath().latin1() ); + else + tqDebug( "not found" ); + + debug("Trying to look for text/plain"); + KMimeType::Ptr s1 = KMimeType::mimeType("text/plain"); + if ( s1 ) + { + debug("Found it !"); + debug(TQString("Comment is %1").arg(s1->comment(KURL(),false))); + } + else + { + debug("Not found !"); + exit(1); + } + + debug("Trying to look for application/x-zerosize"); + KMimeType::Ptr s0 = KMimeType::mimeType("application/x-zerosize"); + if ( s0 ) + { + debug("Found it !"); + debug(TQString("Comment is %1").arg(s0->comment(KURL(),false))); + } + else + { + debug("Not found !"); + exit(1); + } + + debug("Trying to look for Desktop Pager"); + KService::Ptr se = KService::serviceByName("Desktop Pager"); + if ( se ) + { + debug("Found it !"); + debug(TQString("Comment is %1").arg(se->comment())); + } + else + { + debug("Not found !"); + } + + debug("Trying to look for kpager"); + se = KService::serviceByDesktopName("kpager"); + if ( se ) + { + debug("Found it !"); + debug(TQString("Comment is %1").arg(se->comment())); + TQVariant qv = se->property("DocPath"); + debug(TQString("Property type is %1").arg(qv.typeName())); + debug(TQString("Property value is %1").arg(qv.toString())); + } + else + { + debug("Not found !"); + } + + debug("Trying to look for System/kpager.desktop"); + se = KService::serviceByDesktopPath("System/kpager.desktop"); + if ( se ) + { + debug("Found it !"); + debug(TQString("Comment is %1").arg(se->comment())); + } + else + { + debug("Not found !"); + } + + debug("Trying to look for System/fake-entry.desktop"); + se = KService::serviceByDesktopPath("System/fake-entry.desktop"); + if ( se ) + { + debug("Found it !"); + debug(TQString("Comment is %1").arg(se->comment())); + } + else + { + debug("Not found !"); + } + +#if 1 + debug("Querying userprofile for services associated with text/plain"); + KServiceTypeProfile::OfferList offers = KServiceTypeProfile::offers("text/plain"); + debug(TQString("got %1 offers").arg(offers.count())); + KServiceTypeProfile::OfferList::Iterator it = offers.begin(); + for ( ; it != offers.end() ; it++ ) + { + debug((*it).service()->name()); + } + + debug("Querying userprofile for services associated with KOfficeFilter"); + offers = KServiceTypeProfile::offers("KOfficeFilter"); + debug(TQString("got %1 offers").arg(offers.count())); + it = offers.begin(); + for ( ; it != offers.end() ; it++ ) + { + debug((*it).service()->name()); + } + + debug("Querying trader for Konqueror/Plugin"); + KTrader::OfferList traderoffers = KTrader::self()->query("Konqueror/Plugin"); + debug(TQString("got %1 offers").arg(traderoffers.count())); + KTrader::OfferList::Iterator trit = traderoffers.begin(); + for ( ; trit != traderoffers.end() ; trit++ ) + { + debug((*trit)->name()); + } +#endif + + + // + debug("\nTrying findByURL for $TDEDIR/bin/kdesktop"); + KMimeType::Ptr mf = KMimeType::findByURL( KStandardDirs::findExe( "kdesktop" ), 0, + true, false ); + assert( mf ); + check( "A binary's mimetype", mf->name(), "application/x-executable" ); + + // + debug("\nTrying findByURL for folder_home.png"); + TQString fh; + (void)k.iconLoader()->loadIcon("folder_home.png",KIcon::Desktop,0,KIcon::DefaultState,&fh); + mf = KMimeType::findByURL( fh, 0, true, false ); + assert( mf ); + check( "A PNG's mimetype", mf->name(), "image/png" ); + + // + //debug("\nTrying findByURL for Makefile.am"); + //mf = KMimeType::findByURL( KURL("/tmp/Makefile.am"), 0, true, false ); + //assert( mf ); + //debug(TQString("Name is %1").arg(mf->name())); + //debug(TQString("Comment is %1").arg(mf->comment(KURL(),false))); + + debug("\nTrying findByURL for man:/ls"); + mf = KMimeType::findByURL( KURL("man:/ls") ); + assert( mf ); + check( "man:/ls", mf->name(), "text/html" ); + check( "man:/ls/", mf->name(), "text/html" ); + + mf = KMimeType::findByURL( KURL("http://foo/bar.png") ); + check( "HTTP URL", mf->name(), "application/octet-stream" ); // HTTP can't know before downloading + +#if 1 + KMimeType::List mtl; + + mtl = KMimeType::allMimeTypes( ); + assert( mtl.count() ); + debug(TQString("Found %1 mime types.").arg(mtl.count())); + for(int i = 0; i < (int)mtl.count(); i++) + { + debug(TQString("Mime type %1: %2.").arg(i).arg(mtl[i]->name())); + } + + KService::List sl; + + sl = KService::allServices( ); + assert( sl.count() ); + debug(TQString("Found %1 services.").arg(sl.count())); + + KServiceGroup::Ptr root = KServiceGroup::root(); + KServiceGroup::List list = root->entries(); + //KServiceGroup::Ptr topGroup = KServiceGroup::childGroup( "kview" ); + //Q_ASSERT( topGroup ); + //KServiceGroup::List list = topGroup->entries(); + + KServiceGroup::Ptr first; + + debug(TQString("Found %1 entries").arg(list.count())); + for( KServiceGroup::List::ConstIterator it = list.begin(); + it != list.end(); it++) + { + KSycocaEntry *p = (*it); + if (p->isType(KST_KService)) + { + KService *service = static_cast(p); + debug(service->name()); + debug(service->desktopEntryPath()); + } + else if (p->isType(KST_KServiceGroup)) + { + KServiceGroup *serviceGroup = static_cast(p); + debug(TQString(" %1 -->").arg(serviceGroup->caption())); + if (!first) first = serviceGroup; + } + else + { + debug("KServiceGroup: Unexpected object in list!"); + } + } + + if (first) + { + list = first->entries(); + debug(TQString("Found %1 entries").arg(list.count())); + for( KServiceGroup::List::ConstIterator it = list.begin(); + it != list.end(); it++) + { + KSycocaEntry *p = (*it); + if (p->isType(KST_KService)) + { + KService *service = static_cast(p); + debug(TQString(" %1").arg(service->name())); + } + else if (p->isType(KST_KServiceGroup)) + { + KServiceGroup *serviceGroup = static_cast(p); + debug(TQString(" %1 -->").arg(serviceGroup->caption())); + } + else + { + debug("KServiceGroup: Unexpected object in list!"); + } + } + } + + debug("--services that require initialisation--"); + sl = KService::allInitServices(); + for( KService::List::ConstIterator it = sl.begin(); + it != sl.end(); it++) + { + KService *service = static_cast(*it); + debug(service->name()); + } + debug("--End of list--"); + + debug("--protocols--"); + TQStringList stringL = KProtocolInfo::protocols(); + for( TQStringList::ConstIterator it = stringL.begin(); + it != stringL.end(); it++) + { + debug((*it).ascii()); + } + debug("--End of list--"); +#endif + +#if 0 + KImageIO::registerFormats(); + + TQStringList types; + types = KImageIO::types(KImageIO::Reading); + debug("Can read:"); + for(TQStringList::ConstIterator it = types.begin(); + it != types.end(); ++it) + debug(TQString(" %1").arg((*it))); + + types = KImageIO::types(KImageIO::Writing); + debug("Can write:"); + for(TQStringList::ConstIterator it = types.begin(); + it != types.end(); ++it) + debug(TQString(" %1").arg((*it))); + + + TQString rPattern = KImageIO::pattern( KImageIO::Reading ); + debug("Read pattern:\n%s", rPattern.ascii()); + + TQString wPattern = KImageIO::pattern( KImageIO::Writing ); + debug("Write pattern:\n%s", wPattern.ascii()); + + TQString suffix = KImageIO::suffix("JPEG"); + debug("Standard suffix for JPEG: %s", suffix.ascii()); + + types = KImageIO::mimeTypes(KImageIO::Reading); + debug("Can read (mimetypes):"); + for(TQStringList::ConstIterator it = types.begin(); + it != types.end(); ++it) + debug(" %s", (*it).ascii()); + + types = KImageIO::mimeTypes(KImageIO::Writing); + debug("Can write (mimetypes):"); + for(TQStringList::ConstIterator it = types.begin(); + it != types.end(); ++it) + debug(" %s", (*it).ascii()); + + debug("done"); +#endif + return 0; +} diff --git a/kio/tests/tdesycocaupdatetest.cpp b/kio/tests/tdesycocaupdatetest.cpp new file mode 100644 index 000000000..e7778e056 --- /dev/null +++ b/kio/tests/tdesycocaupdatetest.cpp @@ -0,0 +1,11 @@ +#include + +#include + +int main(int argc, char *argv[]) +{ + TDEApplication k(argc,argv,"whatever"); // KMessageBox needs KApp for makeStdCaption + + KService::rebuildKSycoca(0); + return 0; +} -- cgit v1.2.1