From: Karai C. <ck...@us...> - 2005-01-24 16:31:40
|
Update of /cvsroot/krusader/krusader_kde3/krusader/VFS In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5662/krusader_kde3/krusader/VFS Modified Files: krquery.cpp krquery.h Log Message: ARCHITECTURE: using KRQuery instead of QString for filters Index: krquery.h =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/krquery.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** krquery.h 20 Jan 2005 18:14:52 -0000 1.1 --- krquery.h 24 Jan 2005 16:31:29 -0000 1.2 *************** *** 36,47 **** #include "vfile.h" class KRQuery { public: KRQuery(); ~KRQuery() {}; ! bool match( vfile *file ); // checks if the given vfile object matches the conditions ! void normalize(); // make sure KRSearchMod can use the data void setFilter( QString text ); // sets the text for filtering QStringList matches; // what to search --- 36,53 ---- #include "vfile.h" + + class KRQuery { public: KRQuery(); + KRQuery( QString name ); ~KRQuery() {}; ! bool match( vfile *file ) const;// checks if the given vfile object matches the conditions ! bool match( QString name ) const;// matching the filename only ! void normalize(); // make sure KRSearchMod can use the data void setFilter( QString text ); // sets the text for filtering + QString filter() { return origFilter; } // returns the current filter mask + bool isNull() {return bNull;}; QStringList matches; // what to search *************** *** 54,57 **** --- 60,64 ---- bool recurse; // if true recurse ob sub-dirs... bool followLinks; + bool bNull; // flag if the query is null KURL::List whereToSearch; // directorys to search *************** *** 77,84 **** private: ! bool checkPerm(QString perm); ! bool checkType(QString mime); ! bool fileMatch(QString name); ! bool containsContent( QString file ); }; --- 84,92 ---- private: ! bool checkPerm(QString perm) const; ! bool checkType(QString mime) const; ! bool containsContent( QString file ) const; ! ! QString origFilter; }; Index: krquery.cpp =================================================================== RCS file: /cvsroot/krusader/krusader_kde3/krusader/VFS/krquery.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** krquery.cpp 20 Jan 2005 18:14:52 -0000 1.1 --- krquery.cpp 24 Jan 2005 16:31:29 -0000 1.2 *************** *** 47,55 **** contain(QString::null),containCaseSensetive(true), containWholeWord(false), ! inArchive(false),recurse(true),followLinks(true), minSize(0),maxSize(0),newerThen(0),olderThen(0), owner(QString::null),group(QString::null), perm(QString::null),type(QString::null){} void KRQuery::normalize(){ // remove the trailing "/" from the directories lists --- 47,66 ---- contain(QString::null),containCaseSensetive(true), containWholeWord(false), ! inArchive(false),recurse(true),followLinks(true),bNull( true ), minSize(0),maxSize(0),newerThen(0),olderThen(0), owner(QString::null),group(QString::null), perm(QString::null),type(QString::null){} + // set the defaults + KRQuery::KRQuery( QString name ): matchesCaseSensitive(true), + contain(QString::null),containCaseSensetive(true), + containWholeWord(false), + inArchive(false),recurse(true),followLinks(true),bNull( true ), + minSize(0),maxSize(0),newerThen(0),olderThen(0), + owner(QString::null),group(QString::null), + perm(QString::null),type(QString::null) { + setFilter( name ); + } + void KRQuery::normalize(){ // remove the trailing "/" from the directories lists *************** *** 58,62 **** } ! bool KRQuery::checkPerm( QString filePerm ) { for ( int i = 0; i < 9; ++i ) --- 69,73 ---- } ! bool KRQuery::checkPerm( QString filePerm ) const { for ( int i = 0; i < 9; ++i ) *************** *** 65,69 **** } ! bool KRQuery::checkType( QString mime ) { if ( type == mime ) return true; --- 76,80 ---- } ! bool KRQuery::checkType( QString mime ) const { if ( type == mime ) return true; *************** *** 78,82 **** } ! bool KRQuery::fileMatch( const QString name ) { unsigned int len; --- 89,93 ---- } ! bool KRQuery::match( const QString name ) const { unsigned int len; *************** *** 94,101 **** } ! bool KRQuery::match( vfile *vf ) { // see if the name matches ! if ( !fileMatch( vf->vfile_getName() ) ) return false; // checking the mime if( !type.isEmpty() && !checkType( vf->vfile_getMime() ) ) return false; --- 105,112 ---- } ! bool KRQuery::match( vfile *vf ) const { // see if the name matches ! if ( !match( vf->vfile_getName() ) ) return false; // checking the mime if( !type.isEmpty() && !checkType( vf->vfile_getMime() ) ) return false; *************** *** 130,134 **** } ! bool KRQuery::containsContent( QString file ) { QFile qf( file ); --- 141,145 ---- } ! bool KRQuery::containsContent( QString file ) const { QFile qf( file ); *************** *** 167,170 **** --- 178,184 ---- void KRQuery::setFilter( QString text ) { + bNull = false; + origFilter = text; + QString matchText = text; QString excludeText; |