TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tdemimelist.cpp 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #include <ktrader.h>
  2. #include <kservice.h>
  3. #include <kmimetype.h>
  4. #include <assert.h>
  5. #include <kstandarddirs.h>
  6. #include <kservicegroup.h>
  7. #include <kimageio.h>
  8. #include <kuserprofile.h>
  9. #include <kprotocolinfo.h>
  10. #include <tdeapplication.h>
  11. #include <stdio.h>
  12. int main(int argc, char *argv[])
  13. {
  14. TDEApplication k(argc,argv,"blurb",false);
  15. KMimeType::List mtl = KMimeType::allMimeTypes( );
  16. assert( mtl.count() );
  17. tqDebug( "Found %d mime types.", mtl.count() );
  18. TQValueListIterator<KMimeType::Ptr> it(mtl.begin());
  19. KServiceTypeProfile::OfferList ol;
  20. for (; it != mtl.end(); ++it)
  21. {
  22. {
  23. // Application
  24. printf( "APP:%s:", (*it)->name().latin1() );
  25. ol = KServiceTypeProfile::offers((*it)->name(), "Application");
  26. TQValueListIterator<KServiceOffer> it2(ol.begin());
  27. for (; it2 != ol.end(); ++it2) {
  28. if ((*it2).allowAsDefault())
  29. printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
  30. }
  31. printf( "\n" );
  32. }
  33. {
  34. // Embedded
  35. printf( "PART:%s:", (*it)->name().latin1() );
  36. ol = KServiceTypeProfile::offers((*it)->name(), "KParts/ReadOnlyPart");
  37. TQValueListIterator<KServiceOffer> it2(ol.begin());
  38. for (; it2 != ol.end(); ++it2) {
  39. if ((*it2).allowAsDefault())
  40. printf( " %s", (*it2).service()->desktopEntryPath().ascii() );
  41. }
  42. printf( "\n" );
  43. }
  44. }
  45. }