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
153
154
155
|
/***************************************************************************
copyright : (C) 2003-2006 by Robby Stephenson
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of version 2 of the GNU General Public License as *
* published by the Free Software Foundation; *
* *
* In addition, as a special exception, the author gives permission to *
* link the code of this program with the OpenSSL library released by *
* the OpenSSL Project (or with modified versions of OpenSSL that use *
* the same license as OpenSSL), and distribute linked combinations *
* including the two. You must obey the GNU General Public License in *
* all respects for all of the code used other than OpenSSL. If you *
* modify this file, you may extend this exception to your version of *
* the file, but you are not obligated to do so. If you do not wish to *
* do so, delete this exception statement from your version. *
* *
***************************************************************************/
#ifndef TELLICO_Z3950FETCHER_H
#define TELLICO_Z3950FETCHER_H
namespace Tellico {
class XSLTHandler;
namespace GUI {
class LineEdit;
class ComboBox;
}
}
class KIntSpinBox;
class KComboBox;
#include "fetcher.h"
#include "configwidget.h"
#include "../datavectors.h"
#include <tqguardedptr.h>
namespace Tellico {
namespace Fetch {
class Z3950Connection;
/**
* @author Robby Stephenson
*/
class Z3950Fetcher : public Fetcher {
Q_OBJECT
public:
Z3950Fetcher(TQObject* parent, const char* name = 0);
virtual ~Z3950Fetcher();
virtual TQString source() const;
virtual bool isSearching() const { return m_started; }
virtual void search(FetchKey key, const TQString& value);
virtual void continueSearch();
// can search title, person, isbn, or keyword. No UPC or Raw for now.
virtual bool canSearch(FetchKey k) const { return k == Title || k == Person || k == ISBN || k == Keyword || k == LCCN; }
virtual void stop();
virtual Data::EntryPtr fetchEntry(uint uid);
virtual Type type() const { return Z3950; }
virtual bool canFetch(int type) const;
virtual void readConfigHook(const TDEConfigGroup& config);
virtual void saveConfigHook(TDEConfigGroup& config);
virtual void updateEntry(Data::EntryPtr entry);
const TQString& host() const { return m_host; }
static StringMap customFields();
virtual Fetch::ConfigWidget* configWidget(TQWidget* parent) const;
class ConfigWidget;
friend class ConfigWidget;
static TQString defaultName();
protected:
virtual void customEvent(TQCustomEvent* event);
private:
bool initMARC21Handler();
bool initUNIMARCHandler();
bool initMODSHandler();
void process();
void handleResult(const TQString& result);
void done();
Z3950Connection* m_conn;
TQString m_host;
uint m_port;
TQString m_dbname;
TQString m_user;
TQString m_password;
TQString m_sourceCharSet;
TQString m_syntax;
TQString m_pqn; // prefix query notation
TQString m_esn; // element set name
FetchKey m_key;
TQString m_value;
TQMap<int, Data::EntryPtr> m_entries;
bool m_started;
bool m_done;
TQString m_preset;
XSLTHandler* m_MARC21XMLHandler;
XSLTHandler* m_UNIMARCXMLHandler;
XSLTHandler* m_MODSHandler;
TQStringList m_fields;
friend class Z3950Connection;
};
class Z3950Fetcher::ConfigWidget : public Fetch::ConfigWidget {
Q_OBJECT
public:
ConfigWidget(TQWidget* parent, const Z3950Fetcher* fetcher = 0);
virtual ~ConfigWidget();
virtual void saveConfig(TDEConfigGroup& config_);
virtual TQString preferredName() const;
private slots:
void slotTogglePreset(bool on);
void slotPresetChanged();
private:
void loadPresets(const TQString& current);
TQCheckBox* m_usePreset;
GUI::ComboBox* m_serverCombo;
GUI::LineEdit* m_hostEdit;
KIntSpinBox* m_portSpinBox;
GUI::LineEdit* m_databaseEdit;
GUI::LineEdit* m_userEdit;
GUI::LineEdit* m_passwordEdit;
KComboBox* m_charSetCombo;
GUI::ComboBox* m_syntaxCombo;
// have to remember syntax
TQString m_syntax;
};
} // end namespace
} // end namespace
#endif
|