Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

applnksearch.cpp

Go to the documentation of this file.
00001 //
00002 //
00003 // C++ Implementation: $MODULE$
00004 //
00005 // Description:
00006 //
00007 //
00008 // Author: Patrick S. Vogt <tille@handhelds.org>, (C) 2003
00009 //
00010 // Copyright: See COPYING file that comes with this distribution
00011 //
00012 //
00013 #include "applnksearch.h"
00014 #include "applnkitem.h"
00015 
00016 #include <opie2/oresource.h>
00017 
00018 #include <qpe/applnk.h>
00019 #include <qpe/qpeapplication.h>
00020 
00021 
00022 AppLnkSearch::AppLnkSearch(QListView* parent, QString name): SearchGroup(parent, name)
00023 {
00024         _apps = 0;
00025     setPixmap( 0, Opie::Core::OResource::loadPixmap( "osearch/applications", Opie::Core::OResource::SmallIcon ) );
00026 }
00027 
00028 
00029 AppLnkSearch::~AppLnkSearch()
00030 {
00031         delete _apps;
00032 }
00033 
00034 
00035 void AppLnkSearch::load()
00036 {
00037         _apps = new AppLnkSet(QPEApplication::qpeDir());
00038 }
00039 
00040 int AppLnkSearch::search()
00041 {
00042         QList<AppLnk> appList = _apps->children();
00043 
00044         for ( AppLnk *app = appList.first(); app != 0; app = appList.next() ){
00045                 if ( (_search.match( app->name() ) != -1)
00046                     || (_search.match(app->comment()) != -1)
00047                     || (_search.match(app->exec()) != -1) ) {
00048                         insertItem( app );
00049                 }else
00050                 if (searchFile( app ))
00051                         insertItem( app );
00052                 qApp->processEvents( 100 );
00053         }
00054         return _resultCount;
00055 }
00056 
00057 void AppLnkSearch::insertItem( void *rec )
00058 {
00059         (void)new AppLnkItem( this, (AppLnk*)rec );
00060         _resultCount++;
00061 }
00062 
00063 void AppLnkSearch::setSearch(QRegExp re)
00064 {
00065         setOpen( false );
00066         SearchGroup::setSearch( re );
00067 }
00068 

Generated on Sat Nov 5 16:15:54 2005 for OPIE by  doxygen 1.4.2