summaryrefslogtreecommitdiffstats
path: root/krename/ProgressDialog.h
blob: 0bbab515627297aac67f809c4fdef45b581146c4 (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
/***************************************************************************
                          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 <qwidget.h>
#include <kurl.h>

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

class KRenameImpl;
class KListView;
class KPopupMenu;
class KPushButton;
class QProgressBar;
class QStringList;
class QStrList;
class QString;
class QTimer;
class QHBoxLayout;
class QVBoxLayout;
class ProgressDialog : public QWidget
{ 
    Q_OBJECT
    public:
        ProgressDialog( QWidget* 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( QString text, QString pixmap = 0 );
        void error( QString text );
        void warning( QString 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:
        QString count();
        const QString simplify( const QString & text );
        
    protected:
        RenamedList* renamedFiles;
        unsigned int m_size;
        
        KURL m_dest;
        int m_count;
        bool m_canceled;
        KURL::List m_created;
        
        QTimer* m_timer;
        
        KListView* display;
        KPushButton* buttonClose;
        KPushButton* buttonRestart;
        KPushButton* buttonOpenDest;
        KPushButton* buttonUndo;
        KPushButton* buttonCancel;
        KPopupMenu* mnuButton;

        QProgressBar* bar;

        QVBoxLayout* ProgressDialogLayout;
        QHBoxLayout* 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