historyprovider.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <qdict.h>
00021
00022 #include <kapplication.h>
00023
00024 #include "historyprovider.h"
00025
00026 using namespace KParts;
00027 template class QDict<void>;
00028
00029 HistoryProvider * HistoryProvider::s_self = 0L;
00030
00031 class HistoryProvider::HistoryProviderPrivate
00032 {
00033 public:
00034 HistoryProviderPrivate()
00035 : dict( 1009 ) {}
00036
00037 QDict<void> dict;
00038 };
00039
00040 HistoryProvider * HistoryProvider::self()
00041 {
00042 if ( !s_self )
00043 s_self = new HistoryProvider( kapp, "history provider" );
00044 return s_self;
00045 }
00046
00047 HistoryProvider::HistoryProvider( QObject *parent, const char *name )
00048 : QObject( parent, name )
00049 {
00050 if ( !s_self )
00051 s_self = this;
00052
00053 d = new HistoryProviderPrivate;
00054 }
00055
00056 HistoryProvider::~HistoryProvider()
00057 {
00058 delete d;
00059
00060 if ( s_self == this )
00061 s_self = 0;
00062 }
00063
00064 bool HistoryProvider::contains( const QString& item ) const
00065 {
00066 return (bool) d->dict.find( item );
00067 }
00068
00069 void HistoryProvider::insert( const QString& item )
00070 {
00071
00072 d->dict.replace( item, (void*) 1 );
00073 emit inserted( item );
00074 }
00075
00076 void HistoryProvider::remove( const QString& item )
00077 {
00078 (void) d->dict.remove( item );
00079 }
00080
00081 void HistoryProvider::clear()
00082 {
00083 d->dict.clear();
00084 emit cleared();
00085 }
00086
00087 void HistoryProvider::virtual_hook( int, void* )
00088 { }
00089
00090 #include "historyprovider.moc"
|