1
/***************************************************************************
2
copyright : (C) 2005-2006 by Robby Stephenson
3
email : robby@periapsis.org
4
***************************************************************************/
6
/***************************************************************************
8
* This file has been modified to match the requirements of KBibTeX. *
9
* In case of problems or bugs arising from this implementation, please *
10
* contact the KBibTeX team first. *
11
* Thomas Fischer <fischer@unix-ag.uni-kl.de> *
13
***************************************************************************/
15
/***************************************************************************
17
* This program is free software; you can redistribute it and/or modify *
18
* it under the terms of version 2 of the GNU General Public License as *
19
* published by the Free Software Foundation; *
21
***************************************************************************/
23
#ifndef KBIBTEX_Z3950CONNECTION_H
24
#define KBIBTEX_Z3950CONNECTION_H
28
#include <qdeepcopy.h>
30
#include <ksharedptr.h>
33
class Z3950ResultFound : public QCustomEvent {
35
Z3950ResultFound(const QString& s);
37
const QString& result() const { return m_result; }
39
static int uid() { return User + 11111; }
45
class Z3950ConnectionDone : public QCustomEvent {
47
Z3950ConnectionDone(bool more) : QCustomEvent(uid()), m_type(-1), m_hasMore(more) {}
48
Z3950ConnectionDone(bool more, const QString& s, int t) : QCustomEvent(uid()), m_msg(QDeepCopy<QString>(s)), m_type(t), m_hasMore(more) {}
50
const QString& message() const { return m_msg; }
51
int messageType() const { return m_type; }
52
bool hasMoreResults() const { return m_hasMore; }
54
static int uid() { return User + 22222; }
62
class Z3950SyntaxChange : public QCustomEvent {
64
Z3950SyntaxChange(const QString& s) : QCustomEvent(uid()), m_syntax(QDeepCopy<QString>(s)) {}
65
const QString& syntax() const { return m_syntax; }
67
static int uid() { return User + 33333; }
74
* @author Robby Stephenson
76
class Z3950Connection : public QThread {
78
Z3950Connection(QObject* fetcher,
81
const QString& dbname,
82
const QString& sourceCharSet,
83
const QString& syntax,
88
void setQuery(const QString& query, unsigned int numHits);
89
void setUserPassword(const QString& user, const QString& pword);
92
void abort() { m_aborted = true; }
95
static QCString iconvRun(const QCString& text, const QString& fromCharSet, const QString& toCharSet);
96
static QString toXML(const QCString& marc, const QString& fromCharSet);
98
bool makeConnection();
100
void done(const QString& message, int type);
101
QCString toCString(const QString& text);
102
QString toString(const QCString& text);
103
void checkPendingEvents();
117
QString m_sourceCharSet;
125
friend class Z3950ResultFound;
126
static int resultsLeft;