summaryrefslogtreecommitdiffstats
path: root/kiosktool/kiosksync.h
blob: 1879eb270a4813c5220483910c3372390a462966 (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
/*
 *   kiosksync.h
 *
 *   Copyright (C) 2004 Waldo Bastian <bastian@kde.org>
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License version 2 as
 *   published by the Free Software Foundation.
 *
 *   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 _KIOSKSYNC_H_
#define _KIOSKSYNC_H_

#include <tqobject.h>
#include <tqstringlist.h>

#include <kurl.h>

#include "kioskrun.h"

class TQWidget;
class KSimpleConfig;

class KioskSync : public TQObject
{
  Q_OBJECT
  TQ_OBJECT
public:  
  KioskSync( TQWidget* parent = 0, const char* name = 0);
  ~KioskSync();

  void addDir(const TQString &src, const KURL &dest);
  bool sync(bool incremental = false);
  // Returns all files found in the directories
  TQStringList listFiles();
  
signals:
  void finished();
  void status(const TQString &);
  void warning(const TQString &);
  
protected:
  void scanChangedFiles(const TQString &_dir, const TQString &prefix);
  bool syncFile(const TQString &prefix, const TQString &file, const KURL &dest);
  void addChangedDir(const TQString &dir);

private:
  struct SyncDir
  {
     SyncDir()
     { }
     
     SyncDir(const TQString &_src, const KURL &_dest) : src(_src), dest(_dest)
     { }
     
     SyncDir(const SyncDir &dir) : src(dir.src), dest(dir.dest)
     { }
  
     TQString src;
     KURL dest;
  };
  
  typedef TQValueList<SyncDir> SyncDirList;
  
  SyncDirList m_syncDirs;
  TQWidget *m_parent;
  KSimpleConfig *m_timestamps;
  TQStringList m_changedFiles;
  TQStringList m_changedDirs;
  bool m_incremental;
};

#endif