2 Copyright (C) 2008 by Sebastian Trueg <trueg at kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef _NEPOMUK_KIO_NEPOMUK_SEARCH_H_
20 #define _NEPOMUK_KIO_NEPOMUK_SEARCH_H_
22 #include <kio/forwardingslavebase.h>
25 #include "searchfolder.h"
27 #include <QtCore/QQueue>
34 class SearchProtocol
: public KIO::ForwardingSlaveBase
39 SearchProtocol( const QByteArray
& poolSocket
, const QByteArray
& appSocket
);
40 virtual ~SearchProtocol();
45 void listDir( const KUrl
& url
);
48 * Will be forwarded for files.
50 void get( const KUrl
& url
);
55 void put( const KUrl
& url
, int permissions
, KIO::JobFlags flags
);
58 * Files will be forwarded.
59 * Folders will be created as virtual folders.
61 void mimetype( const KUrl
& url
);
64 * Files will be forwarded.
65 * Folders will be created as virtual folders.
67 void stat( const KUrl
& url
);
71 * reimplemented from ForwardingSlaveBase
73 bool rewriteUrl( const KUrl
& url
, KUrl
& newURL
);
77 void listQuery( const QString
& query
);
79 void listDefaultSearches();
80 void listDefaultSearch( const QString
& path
);
81 void addDefaultSearch( const QString
& name
, const Search::Query
& );
83 SearchFolder
* extractSearchFolder( const KUrl
& url
);
86 * Get (possibly cached) query results
88 SearchFolder
* getQueryResults( const QString
& query
);
89 SearchFolder
* getDefaultQueryFolder( const QString
& name
);
91 // the default search folders
92 QHash
<QString
, Nepomuk::Search::Query
> m_defaultSearches
;
94 // cache of all on-the-fly search folders
95 QHash
<QString
, SearchFolder
*> m_searchCache
;
97 // queue to remember the order of the search cache
98 // when enforcing the cache max
99 QQueue
<QString
> m_searchCacheNameQueue
;
101 // cache for the default searches, needs to differ from
102 // on-the-fly cache because of the name
103 QHash
<QString
, SearchFolder
*> m_defaultSearchCache
;