summaryrefslogtreecommitdiffstats
path: root/src/tdeioclient/commandhandler.h
blob: 29fb552d7c81d1dd1bd66bbfea1fa1ef33538da1 (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
//-*-c++-*-
/***************************************************************************
 *   Copyright (C) 2004 by Fred Schaettgen <[email protected]>*
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#ifndef COMMANDHANDLER_H
#define COMMANDHANDLER_H

#include <tqobject.h>
#include <tqstringlist.h>
#include <tdeio/jobclasses.h>
#include <tqfile.h>
#include <kurl.h>

class TDECmdLineArgs;
namespace TDEIO { class Job; }

class CommandHandler : public TQObject
{
    Q_OBJECT

public:
    CommandHandler(TDECmdLineArgs *args);
    ~CommandHandler();
    void start();

private:
    KURL::List urlList(const TQStringList& list);
    void exitPrintUsage(const TQString& message);
    void list(const TQString& target);
    void get(const TQString& target);
    void put(const TQString& target);
    void mkdir(const TQString& target);
    void rmdir(const TQString& target);
    void del(const TQStringList& targets);
    void copy(const TQStringList& sources, const TQString& target);
    void commonConnect(TDEIO::Job* job);

    TQString command, origCommand, target, lastMessage;
    TQStringList targets, sources;
    TDEIO::Job* job;     
    int returnValue;
    TDECmdLineArgs *args;
    TQFile outFile, inFile;
    bool showProgressWindow, overwrite, iterate;

private slots:
    void slotFinished(TDEIO::Job *job);
    void slotEntries(TDEIO::Job* job, const TDEIO::UDSEntryList& list);
    void slotData(TDEIO::Job *, const TQByteArray &data);
    void slotDataReq(TDEIO::Job *, TQByteArray &data);
    void slotInfoMessage(TDEIO::Job* job,const TQString& msg);
    void slotPercent(TDEIO::Job* job, unsigned long percent);
};

#endif