Parent: [52bc9f] (diff)

Child: [de82f1] (diff)

Download this file

reslist.h    153 lines (135 with data), 4.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* Copyright (C) 2005 J.F.Dockes
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _RESLIST_H_INCLUDED_
#define _RESLIST_H_INCLUDED_
#include <list>
#include <utility>
#ifndef NO_NAMESPACES
using std::list;
using std::pair;
#endif
#ifdef RESLIST_TEXTBROWSER
#include <QTextBrowser>
#define RESLIST_PARENTCLASS QTextBrowser
#else
#include <QtWebKit/QWebView>
#define RESLIST_PARENTCLASS QWebView
#endif
#include "docseq.h"
#include "sortseq.h"
#include "filtseq.h"
#include "refcntr.h"
#include "rcldoc.h"
#include "reslistpager.h"
class RclMain;
class QtGuiResListPager;
/**
* Display a list of document records. The data can be out of the history
* manager or from an index query, both abstracted as a DocSequence.
*/
class ResList : public RESLIST_PARENTCLASS
{
Q_OBJECT;
friend class QtGuiResListPager;
public:
ResList(QWidget* parent = 0, const char* name = 0);
virtual ~ResList();
// Return document for given docnum. We mostly act as an
// intermediary to the docseq here, but this has also the
// side-effect of making the entry current (visible and
// highlighted), and only works if the num is inside the current
// page or its immediate neighbours.
bool getDoc(int docnum, Rcl::Doc &);
bool displayingHistory();
int listId() const {return m_listId;}
int pageFirstDocNum();
void setFont();
void setRclMain(RclMain *m)
{
m_parent = m;
}
public slots:
virtual void setDocSource(RefCntr<DocSequence> nsource);
virtual void resetList(); // Erase current list
virtual void resPageUpOrBack(); // Page up pressed
virtual void resPageDownOrNext(); // Page down pressed
virtual void resultPageBack(); // Previous page of results
virtual void resultPageFirst(); // First page of results
virtual void resultPageNext(); // Next (or first) page of results
virtual void resultPageFor(int docnum); // Page containing docnum
virtual void menuPreview();
virtual void menuSaveToFile();
virtual void menuEdit();
virtual void menuCopyFN();
virtual void menuCopyURL();
virtual void menuExpand();
virtual void menuPreviewParent();
virtual void menuOpenParent();
virtual void menuOpenSnippets();
virtual void previewExposed(int);
virtual void append(const QString &text);
virtual void readDocSource();
virtual void highlighted(const QString& link);
virtual void createPopupMenu(const QPoint& pos);
signals:
void nextPageAvailable(bool);
void prevPageAvailable(bool);
void docEditClicked(Rcl::Doc);
void docPreviewClicked(int, Rcl::Doc, int);
void docSaveToFileClicked(Rcl::Doc);
void previewRequested(Rcl::Doc);
void editRequested(Rcl::Doc);
void headerClicked();
void docExpand(Rcl::Doc);
void wordSelect(QString);
void wordReplace(const QString&, const QString&);
void hasResults(int);
protected:
void keyPressEvent(QKeyEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void mouseDoubleClickEvent(QMouseEvent*);
protected slots:
virtual void languageChange();
virtual void linkWasClicked(const QUrl &);
private:
QtGuiResListPager *m_pager;
RefCntr<DocSequence> m_source;
int m_popDoc; // Docnum for the popup menu.
int m_curPvDoc;// Docnum for current preview
int m_lstClckMod; // Last click modifier.
int m_listId; // query Id for matching with preview windows
#ifdef RESLIST_TEXTBROWSER
// Translate from textedit paragraph number to relative
// docnum. Built while we insert text into the qtextedit
std::map<int,int> m_pageParaToReldocnums;
virtual int docnumfromparnum(int);
virtual pair<int,int> parnumfromdocnum(int);
#else
// Webview makes it more difficult to append text incrementally,
// so we store the page and display it when done.
QString m_text;
#endif
RclMain *m_parent;
virtual void displayPage(); // Display current page
static int newListId();
void resetView();
bool scrollIsAtTop();
bool scrollIsAtBottom();
void setupArrows();
void newSnippetsW(const Rcl::Doc &doc);
};
#endif /* _RESLIST_H_INCLUDED_ */