~ubuntu-branches/debian/experimental/choqok/experimental

« back to all changes in this revision

Viewing changes to choqok/searchwindow.h

  • Committer: Bazaar Package Importer
  • Author(s): Noah Meyerhans
  • Date: 2009-09-07 13:22:24 UTC
  • Revision ID: james.westby@ubuntu.com-20090907132224-jflmaoad8rhhaki8
Tags: upstream-0.6.6
ImportĀ upstreamĀ versionĀ 0.6.6

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 SEARCHWINDOW_H
 
26
#define SEARCHWINDOW_H
 
27
 
 
28
#include <QWidget>
 
29
#include <QKeyEvent>
 
30
#include <QIntValidator>
 
31
 
 
32
#include "ui_searchwidget_base.h"
 
33
#include "account.h"
 
34
#include "search.h"
 
35
 
 
36
class StatusWidget;
 
37
 
 
38
/**
 
39
The Search Widget
 
40
 
 
41
For any microblogging service compatible with the Twitter Search API
 
42
 
 
43
 @author Stephen Henderson \<hendersonsk@gmail.com\>
 
44
 @author Mehrdad Momeny \<mehrdad.momeny@gmail.com\>
 
45
*/
 
46
class SearchWindow : public QWidget
 
47
{
 
48
    Q_OBJECT
 
49
public:
 
50
    explicit SearchWindow(const Account &account, QWidget* parent = 0 );
 
51
    ~SearchWindow();
 
52
 
 
53
    void clearSearchResults();
 
54
    void updateStatusList();
 
55
    void setAccount(const Account &account);
 
56
    void init(int type = 0, const QString & query = QString());
 
57
 
 
58
protected:
 
59
    virtual void keyPressEvent( QKeyEvent *e );
 
60
 
 
61
public slots:
 
62
    void updateSearchResults();
 
63
    void autoUpdateSearchResults();
 
64
    void updateNumPages();
 
65
 
 
66
protected slots:
 
67
    void search();
 
68
    void searchResultsReceived( QList<Status> &stautsList );
 
69
    void error( QString message );
 
70
 
 
71
signals:
 
72
    void forwardReply( const QString &username, qulonglong statusId, bool dMsg );
 
73
    void forwardFavorited( qulonglong statusId, bool isFavorite );
 
74
    void forwardReTweet( const QString &text );
 
75
//     void updateTimeLines();
 
76
 
 
77
private:
 
78
    void addNewStatusesToUi( QList<Status> &statusList );
 
79
    void resetSearchArea(int type = 0, const QString & query = QString());
 
80
    void markStatusesAsRead();
 
81
 
 
82
private slots:
 
83
    void updateSearchArea(int type = 0, const QString & query = QString());
 
84
    void refresh();
 
85
    void goForward();
 
86
    void goBack();
 
87
    void pageChange();
 
88
    void showNavigation( bool showNav );
 
89
    void slotSearchTypeChanged(int);
 
90
 
 
91
protected:
 
92
    QList<StatusWidget*> listResults;
 
93
 
 
94
private:
 
95
    Account mAccount;
 
96
    Search* mSearch;
 
97
    Ui::searchwidget_base ui;
 
98
    qulonglong page;
 
99
    qulonglong lastValidPage;
 
100
    QString lastSearchQuery;
 
101
    int lastSearchType;
 
102
    QIntValidator* intValidator;
 
103
};
 
104
 
 
105
#endif