summaryrefslogtreecommitdiffstats
path: root/krename/ProgressDialog.h
blob: cfd9528a86b8e033a6fa8a37829d7a522f58f33e (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/***************************************************************************
                          ProgressDialog.h  -  description
                             -------------------
    begin                : Die Mai 15 15:34:19 CEST 2001
    copyright            : (C) 2001 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 PROGRESSDIALOG_H
#define PROGRESSDIALOG_H

#include <tqwidget.h>
#include <kurl.h>

typedef struct RenamedList
{
    KURL src;
    KURL dst;
        
    bool dir;    
    bool error;
};

class KRenameImpl;
class TDEListView;
class TDEPopupMenu;
class KPushButton;
class TQProgressBar;
class TQStringList;
class TQStrList;
class TQString;
class TQTimer;
class TQHBoxLayout;
class TQVBoxLayout;
class ProgressDialog : public TQWidget
{ 
    Q_OBJECT
  
    public:
        ProgressDialog( TQWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
        ~ProgressDialog();

        void setProgressTotalSteps( int t );
        void setProgress( int p );

        inline bool wasCancelled() const;
        inline void setDestination( const KURL & dir );
        inline void setRenamedFiles( RenamedList* list, unsigned int size ) ;
        inline void setCreatedDirectories( const KURL::List & list );

        void done( int errors, int successfull, bool allowundo );
        void print( TQString text, TQString pixmap = 0 );
        void error( TQString text );
        void warning( TQString text );
        
    public slots:
        void show();
        
    private slots:
        void quitAll();
        void restart();
        void again();
        void unAgain();
        void allAgain();
        void openDest();
        void canceled();
        void undo();
        void slotTimer();
        
    private:
        TQString count();
        const TQString simplify( const TQString & text );
        
    protected:
        RenamedList* renamedFiles;
        unsigned int m_size;
        
        KURL m_dest;
        int m_count;
        bool m_canceled;
        KURL::List m_created;
        
        TQTimer* m_timer;
        
        TDEListView* display;
        KPushButton* buttonClose;
        KPushButton* buttonRestart;
        KPushButton* buttonOpenDest;
        KPushButton* buttonUndo;
        KPushButton* buttonCancel;
        TDEPopupMenu* mnuButton;

        TQProgressBar* bar;

        TQVBoxLayout* ProgressDialogLayout;
        TQHBoxLayout* Layout1;
};


bool ProgressDialog::wasCancelled() const
{ 
    return m_canceled;
}

void ProgressDialog::setDestination( const KURL & dir ) 
{
    m_dest = dir;
}

void ProgressDialog::setRenamedFiles( RenamedList* list, unsigned int size ) 
{
    renamedFiles = list;
    m_size = size;
}
        
void ProgressDialog::setCreatedDirectories( const KURL::List & list ) 
{
    m_created = list;
}

#endif // PROGRESSDIALOG_H