summaryrefslogtreecommitdiffstats
path: root/kpilot/lib/kpilotlocallink.h
blob: ca37bb57d04f0aece53966cc79df8fcf6e601bd2 (plain)
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
#ifndef _KPILOT_KPILOTLOCALLINK_H
#define _KPILOT_KPILOTLOCALLINK_H
/*
**
** Copyright (C) 1998-2001 by Dan Pilone
** Copyright (C) 2003-2004 Reinhold Kainhofer <[email protected]>
** Copyright (C) 2006 Adriaan de Groot <[email protected]>
**
*/

/*
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU Lesser General Public License as published by
** the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public License
** along with this program in a file called COPYING; if not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
** MA 02110-1301, USA.
*/

/*
** Bug reports and questions can be sent to [email protected]
*/

#include "kpilotlink.h"

/** @file
* Definition of the local link class; implemented in kpilotlink.cc .
*/


/**
* Implementation of the device link for file-system backed (ie. local, fake)
* devices. Uses a directory specified in the reset() call to serve databases.
*/
class KDE_EXPORT KPilotLocalLink : public KPilotLink
{
Q_OBJECT
public:
	KPilotLocalLink( TQObject *parent=0L, const char *name=0L );
	virtual ~KPilotLocalLink();

	virtual TQString statusString() const;
	virtual bool isConnected() const;
	virtual void reset( const TQString & );
	virtual void close();
	virtual void reset();
	virtual bool tickle();
	virtual const KPilotCard *getCardInfo(int card);
	virtual void endSync( EndOfSyncFlags f );
	virtual int openConduit();
	virtual int getNextDatabase(int index,struct DBInfo *);
	virtual int findDatabase(const char *name, struct DBInfo*,
		int index=0, unsigned long type=0, unsigned long creator=0);
	virtual bool retrieveDatabase(const TQString &path, struct DBInfo *db);
	virtual DBInfoList getDBList(int cardno=0, int flags=dlpDBListRAM);
	virtual PilotDatabase *database( const TQString &name );

public slots:
	void ready();

protected:
	virtual bool installFile(const TQString &, const bool deleteFile);
	virtual void addSyncLogEntryImpl( const TQString &s );
	virtual int pilotSocket() const
	{
		return -1;
	}

protected:
	bool fReady;
	TQString fPath;

	class Private;
	Private *d;

	/**
	* Pre-process the directory @p path to find out which databases
	* live there.
	*
	* @return Number of database in @p path.
	*/
	unsigned int findAvailableDatabases( Private &, const TQString &path );
} ;


#endif