~ubuntu-branches/ubuntu/karmic/choqok/karmic

« back to all changes in this revision

Viewing changes to src/search.h

  • Committer: Bazaar Package Importer
  • Author(s): Christian Mangold
  • Date: 2009-04-30 20:41:19 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090430204119-v1k5uw4aejloyfo7
Tags: 0.5-0ubuntu1
* New upstream release (LP: #370009)
* Bumped Standards-Version to 3.8.1
* Switched to pkg-kde-tools

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of choqoK, the KDE micro-blogging client
 
3
 
 
4
    Copyright (C) 2008-2009 Mehrdad Momeny <mehrdad.momeny@gmail.com>
 
5
 
 
6
    This program is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU General Public License as
 
8
    published by the Free Software Foundation; either version 2 of
 
9
    the License or (at your option) version 3 or any later version
 
10
    accepted by the membership of KDE e.V. (or its successor approved
 
11
    by the membership of KDE e.V.), which shall act as a proxy
 
12
    defined in Section 14 of version 3 of the license.
 
13
 
 
14
 
 
15
    This program is distributed in the hope that it will be useful,
 
16
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
18
    GNU General Public License for more details.
 
19
 
 
20
    You should have received a copy of the GNU General Public License
 
21
    along with this program; if not, see http://www.gnu.org/licenses/
 
22
 
 
23
*/
 
24
 
 
25
#ifndef SEARCH_H
 
26
#define SEARCH_H
 
27
 
 
28
#include <QString>
 
29
#include <QObject>
 
30
#include <QMap>
 
31
#include <QPair>
 
32
#include <KUrl>
 
33
 
 
34
#include "datacontainers.h"
 
35
 
 
36
class KJob;
 
37
class Account;
 
38
 
 
39
/**
 
40
    Base class for search feature.
 
41
    @author Stephen Henderson <hendersonsk@gmail.com>
 
42
*/
 
43
class Search : public QObject
 
44
{
 
45
    Q_OBJECT
 
46
public:
 
47
    explicit Search( Account* account, const QString searchUrl = QString(), QObject *parent=0 );
 
48
    virtual ~Search();
 
49
 
 
50
    QMap<int, QPair<QString, bool> > getSearchTypes();
 
51
 
 
52
private:
 
53
    virtual KUrl buildUrl( QString query, int option, uint sinceStatusId = 0, uint count = 0, uint page = 1 );
 
54
 
 
55
public slots:
 
56
    virtual void requestSearchResults( QString query,
 
57
                                       int option,
 
58
                                       uint sinceStatusId = 0,
 
59
                                       uint count = 0,
 
60
                                       uint page = 1 );
 
61
 
 
62
protected slots:
 
63
    virtual void searchResultsReturned( KJob *job );
 
64
    virtual void singleStatusReturned( KJob* job );
 
65
 
 
66
signals:
 
67
    void searchResultsReceived( QList<Status> &statusList );
 
68
    void error( QString message );
 
69
 
 
70
protected:
 
71
    // The QString in the QPair is a human readable string describing what the type searches for. The boolean value
 
72
    // determines whether or not the search type is traversable (if the forward and back buttons should be displayed).
 
73
    QMap<int, QPair<QString, bool> > mSearchTypes;
 
74
    uint mSinceStatusId;
 
75
    QString mSearchUrl;
 
76
    Account* mAccount;
 
77
};
 
78
 
 
79
#endif