summaryrefslogtreecommitdiffstats
path: root/kio/tests/kioslavetest.h
blob: 02fae7f231d6fa0ab0366a1e95cecdd0e3e2a68a (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
96
97
98
99
100
101
102
103
104
105
106
107
108
 /*
  This file is or will be part of KDE desktop environment

  Copyright 1999 Matt Koss <koss@miesto.sk>

  It is licensed under GPL version 2.

  If it is part of KDE libraries than this file is licensed under
  LGPL version 2.
 */

#ifndef _KIOSLAVETEST_H
#define _KIOSLAVETEST_H

#include <tqlabel.h>
#include <tqlineedit.h>
#include <tqradiobutton.h>
#include <tqpushbutton.h>
#include <tqbuttongroup.h>
#include <tqwidget.h>

#include <kmainwindow.h>

#include "kio/job.h"
#include "kio/global.h"
#include "kio/statusbarprogress.h"
#include "kio/slave.h"

class KioslaveTest : public KMainWindow {
  Q_OBJECT

public:
  KioslaveTest( TQString src, TQString dest, uint op, uint pr );
  ~KioslaveTest() {}

  enum Operations { List, ListRecursive, Stat, Get, Put, Copy, Move, Delete, Shred, Mkdir, Mimetype };

  enum ProgressModes { ProgressNone, ProgressDefault, ProgressStatus };

protected:

  void closeEvent( TQCloseEvent * );

  void printUDSEntry( const KIO::UDSEntry & entry );

  // info stuff
  TQLabel *lb_from;
  TQLineEdit *le_source;

  TQLabel *lb_to;
  TQLineEdit *le_dest;

  // operation stuff
  TQButtonGroup *opButtons;

  TQRadioButton *rbList;
  TQRadioButton *rbListRecursive;
  TQRadioButton *rbStat;
  TQRadioButton *rbGet;
  TQRadioButton *rbPut;
  TQRadioButton *rbCopy;
  TQRadioButton *rbMove;
  TQRadioButton *rbDelete;
  TQRadioButton *rbShred;
  TQRadioButton *rbMkdir;
  TQRadioButton *rbMimetype;

  // progress stuff
  TQButtonGroup *progressButtons;

  TQRadioButton *rbProgressNone;
  TQRadioButton *rbProgressDefault;
  TQRadioButton *rbProgressStatus;

  TQPushButton *pbStart;
  TQPushButton *pbStop;

  TQPushButton *close;

protected slots:
  void changeOperation( int id );
  void changeProgressMode( int id );

  void startJob();
  void stopJob();

  void slotResult( KIO::Job * );
  void slotEntries( KIO::Job *, const KIO::UDSEntryList& );
  void slotData( KIO::Job *, const TQByteArray &data );
  void slotDataReq( KIO::Job *, TQByteArray &data );

  void slotQuit();
  void slotSlaveConnected();
  void slotSlaveError();

private:
  KIO::Job *job;
  TQWidget *main_widget;

  KIO::StatusbarProgress *statusProgress;

  int selectedOperation;
  int progressMode;
  int putBuffer;
  KIO::Slave *slave;
};

#endif // _KIOSLAVETEST_H