delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / khelpcenter / tests / testmetainfo.cpp
blobd535fd10d4edb0564499f816a6686a08307541d9
1 #include <QCoreApplication>
3 #include <kaboutdata.h>
4 #include <kdebug.h>
5 #include <klocale.h>
6 #include <kcmdlineargs.h>
8 #include "docmetainfo.h"
9 #include "docentrytraverser.h"
11 using namespace KHC;
13 class MyTraverser : public DocEntryTraverser
15 public:
16 MyTraverser( const QString &indent = "" ) : mIndent( indent ) {}
18 void process( DocEntry *entry )
20 kDebug() << mIndent << entry->name() << " - WEIGHT: " << entry->weight()
21 << endl;
22 #if 0
23 if ( entry->parent() ) kDebug() << mIndent << " PARENT: "
24 << entry->parent()->name() << endl;
25 if ( entry->nextSibling() ) kDebug() << mIndent << " NEXT: "
26 << entry->nextSibling()->name() << endl;
27 #endif
30 DocEntryTraverser *createChild( DocEntry * )
32 return new MyTraverser( mIndent + " " );
35 private:
36 QString mIndent;
39 class LinearTraverser : public DocEntryTraverser
41 public:
42 void process( DocEntry *entry )
44 kDebug() << "PROCESS: " << entry->name();
47 DocEntryTraverser *createChild( DocEntry * )
49 return this;
52 DocEntryTraverser *parentTraverser()
54 return this;
57 void deleteTraverser() {}
60 class AsyncTraverser : public DocEntryTraverser
62 public:
63 AsyncTraverser( const QString &indent = "" ) : mIndent( indent )
65 // kDebug() << "AsyncTraverser()";
68 ~AsyncTraverser()
70 // kDebug() << "~AsyncTraverser()";
73 void process( DocEntry *entry )
75 kDebug() << mIndent << entry->name();
78 DocEntryTraverser *createChild( DocEntry * )
80 // kDebug() << "AsyncTraverser::childTraverser()";
81 return new AsyncTraverser( mIndent + " " );
84 private:
85 QString mIndent;
88 int main(int argc,char **argv)
90 KAboutData aboutData("testmetainfo", 0,ki18n("TestDocMetaInfo"),"0.1");
91 // KComponentData componentData(&aboutData); doesn't seem to be necessary
92 QCoreApplication app(argc,argv);
94 kDebug() << "Scanning Meta Info";
96 DocMetaInfo::self()->scanMetaInfo( );
98 kDebug() << "My TRAVERSE start";
99 MyTraverser t;
100 DocMetaInfo::self()->startTraverseEntries( &t );
101 kDebug() << "My TRAVERSE end";
103 kDebug() << "Linear TRAVERSE start";
104 LinearTraverser l;
105 DocMetaInfo::self()->startTraverseEntries( &l );
106 kDebug() << "Linear TRAVERSE end";
108 kDebug() << "Async TRAVERSE start";
109 AsyncTraverser a;
110 DocMetaInfo::self()->startTraverseEntries( &a );
111 kDebug() << "Async TRAVERSE end";
113 return 0;
115 // vim:ts=2:sw=2:et