add more spacing
[personal-kdebase.git] / runtime / nepomuk / kioslaves / search / kio_nepomuksearch.h
blob7c7d1bd77eb86cc2982aaa8fa4e8e7c434edd421
1 /*
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)
7 any later version.
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>
24 #include "term.h"
25 #include "searchfolder.h"
27 #include <QtCore/QQueue>
29 namespace Nepomuk {
30 namespace Search {
31 class Query;
34 class SearchProtocol : public KIO::ForwardingSlaveBase
36 Q_OBJECT
38 public:
39 SearchProtocol( const QByteArray& poolSocket, const QByteArray& appSocket );
40 virtual ~SearchProtocol();
42 /**
45 void listDir( const KUrl& url );
47 /**
48 * Will be forwarded for files.
50 void get( const KUrl& url );
52 /**
53 * Not supported.
55 void put( const KUrl& url, int permissions, KIO::JobFlags flags );
57 /**
58 * Files will be forwarded.
59 * Folders will be created as virtual folders.
61 void mimetype( const KUrl& url );
63 /**
64 * Files will be forwarded.
65 * Folders will be created as virtual folders.
67 void stat( const KUrl& url );
69 protected:
70 /**
71 * reimplemented from ForwardingSlaveBase
73 bool rewriteUrl( const KUrl& url, KUrl& newURL );
75 private:
76 void listRoot();
77 void listQuery( const QString& query );
78 void listActions();
79 void listDefaultSearches();
80 void listDefaultSearch( const QString& path );
81 void addDefaultSearch( const QString& name, const Search::Query& );
83 SearchFolder* extractSearchFolder( const KUrl& url );
85 /**
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;
107 #endif