comparison kdiff3/src-QT4/fileaccess.h @ 80:fcd146072e0c

0.9.93
author joachim99
date Tue, 06 Jan 2009 17:51:29 +0000
parents 1184fc843210
children 6f42f5bd218e
comparison
equal deleted inserted replaced
79:881e47f5076b 80:fcd146072e0c
11 #ifndef FILEACCESS_H 11 #ifndef FILEACCESS_H
12 #define FILEACCESS_H 12 #define FILEACCESS_H
13 13
14 #include <QDialog> 14 #include <QDialog>
15 #include <QDateTime> 15 #include <QDateTime>
16 16 #include <QEventLoop>
17 #include <kprogress.h> 17 #include <QLabel>
18 #include <QProgressBar>
19
20 #include <kprogressdialog.h>
18 #include <kio/job.h> 21 #include <kio/job.h>
19 #include <kio/jobclasses.h> 22 #include <kio/jobclasses.h>
20 #include <kurldrag.h>
21 23
22 #include <list> 24 #include <list>
23 25
24 bool wildcardMultiMatch( const QString& wildcard, const QString& testString, bool bCaseSensitive ); 26 bool wildcardMultiMatch( const QString& wildcard, const QString& testString, bool bCaseSensitive );
25 27
51 QDateTime lastRead() const; 53 QDateTime lastRead() const;
52 54
53 QString fileName() const; // Just the name-part of the path, without parent directories 55 QString fileName() const; // Just the name-part of the path, without parent directories
54 QString filePath() const; // The path-string that was used during construction 56 QString filePath() const; // The path-string that was used during construction
55 QString prettyAbsPath() const; 57 QString prettyAbsPath() const;
56 KURL url() const; 58 KUrl url() const;
57 QString absFilePath() const; 59 QString absoluteFilePath() const;
58 60
59 bool isLocal() const; 61 bool isLocal() const;
60 62
61 bool readFile(void* pDestBuffer, unsigned long maxLength ); 63 bool readFile(void* pDestBuffer, unsigned long maxLength );
62 bool writeFile(const void* pSrcBuffer, unsigned long length ); 64 bool writeFile(const void* pSrcBuffer, unsigned long length );
71 bool removeFile(); 73 bool removeFile();
72 static bool removeFile( const QString& ); 74 static bool removeFile( const QString& );
73 static bool makeDir( const QString& ); 75 static bool makeDir( const QString& );
74 static bool removeDir( const QString& ); 76 static bool removeDir( const QString& );
75 static bool exists( const QString& ); 77 static bool exists( const QString& );
76 static QString cleanDirPath( const QString& ); 78 static QString cleanPath( const QString& );
77 79
78 //bool chmod( const QString& ); 80 //bool chmod( const QString& );
79 bool rename( const QString& ); 81 bool rename( const QString& );
80 static bool symLink( const QString& linkTarget, const QString& linkLocation ); 82 static bool symLink( const QString& linkTarget, const QString& linkLocation );
81 83
82 void addPath( const QString& txt ); 84 void addPath( const QString& txt );
83 QString getStatusText(); 85 QString getStatusText();
84 private: 86 private:
85 void setUdsEntry( const KIO::UDSEntry& e ); 87 void setUdsEntry( const KIO::UDSEntry& e );
86 KURL m_url; 88 KUrl m_url;
87 bool m_bLocal; 89 bool m_bLocal;
88 bool m_bValidData; 90 bool m_bValidData;
89 91
90 unsigned long m_size; 92 unsigned long m_size;
91 QDateTime m_modificationTime; 93 QDateTime m_modificationTime;
104 QString m_linkTarget; 106 QString m_linkTarget;
105 QString m_user; 107 QString m_user;
106 QString m_group; 108 QString m_group;
107 QString m_name; 109 QString m_name;
108 QString m_path; 110 QString m_path;
109 QString m_absFilePath; 111 QString m_absoluteFilePath;
110 QString m_localCopy; 112 QString m_localCopy;
111 QString m_statusText; // Might contain an error string, when the last operation didn't succeed. 113 QString m_statusText; // Might contain an error string, when the last operation didn't succeed.
112 114
113 friend class FileAccessJobHandler; 115 friend class FileAccessJobHandler;
114 }; 116 };
154 bool m_bFollowDirLinks; 156 bool m_bFollowDirLinks;
155 157
156 bool scanLocalDirectory( const QString& dirName, t_DirectoryList* dirList ); 158 bool scanLocalDirectory( const QString& dirName, t_DirectoryList* dirList );
157 159
158 private slots: 160 private slots:
159 void slotStatResult( KIO::Job* ); 161 void slotStatResult( KJob* );
160 void slotSimpleJobResult( KIO::Job* pJob ); 162 void slotSimpleJobResult( KJob* pJob );
161 void slotPutJobResult( KIO::Job* pJob ); 163 void slotPutJobResult( KJob* pJob );
162 164
163 void slotGetData(KIO::Job*,const QByteArray&); 165 void slotGetData(KJob*,const QByteArray&);
164 void slotPutData(KIO::Job*, QByteArray&); 166 void slotPutData(KJob*, QByteArray&);
165 167
166 void slotListDirInfoMessage( KIO::Job*, const QString& msg ); 168 void slotListDirInfoMessage( KJob*, const QString& msg );
167 void slotListDirProcessNewEntries( KIO::Job *, const KIO::UDSEntryList& l ); 169 void slotListDirProcessNewEntries( KIO::Job *, const KIO::UDSEntryList& l );
168 170
169 void slotPercent( KIO::Job* pJob, unsigned long percent ); 171 void slotPercent( KJob* pJob, unsigned long percent );
170 }; 172 };
171 173
172 class ProgressDialog : public QDialog 174 class ProgressDialog : public QDialog
173 { 175 {
174 Q_OBJECT 176 Q_OBJECT
190 // Requirement: 0 < dMin < dMax < 1 192 // Requirement: 0 < dMin < dMax < 1
191 void setRangeTransformation( double dMin, double dMax ); 193 void setRangeTransformation( double dMin, double dMax );
192 void setSubRangeTransformation( double dMin, double dMax ); 194 void setSubRangeTransformation( double dMin, double dMax );
193 195
194 void exitEventLoop(); 196 void exitEventLoop();
195 void enterEventLoop( KIO::Job* pJob, const QString& jobInfo ); 197 void enterEventLoop( KJob* pJob, const QString& jobInfo );
196 198
197 bool wasCancelled(); 199 bool wasCancelled();
198 void show(); 200 void show();
199 void hide(); 201 void hide();
200 202
218 std::list<ProgressLevelData> m_progressStack; 220 std::list<ProgressLevelData> m_progressStack;
219 221
220 int m_progressDelayTimer; 222 int m_progressDelayTimer;
221 std::list<QEventLoop*> m_eventLoopStack; 223 std::list<QEventLoop*> m_eventLoopStack;
222 224
223 KProgress* m_pProgressBar; 225 QProgressBar* m_pProgressBar;
224 KProgress* m_pSubProgressBar; 226 QProgressBar* m_pSubProgressBar;
225 QLabel* m_pInformation; 227 QLabel* m_pInformation;
226 QLabel* m_pSubInformation; 228 QLabel* m_pSubInformation;
227 QLabel* m_pSlowJobInfo; 229 QLabel* m_pSlowJobInfo;
228 QPushButton* m_pAbortButton; 230 QPushButton* m_pAbortButton;
229 void recalc(bool bRedrawUpdate); 231 void recalc(bool bRedrawUpdate);
230 QTime m_t1; 232 QTime m_t1;
231 QTime m_t2; 233 QTime m_t2;
232 bool m_bWasCancelled; 234 bool m_bWasCancelled;
233 KIO::Job* m_pJob; 235 KJob* m_pJob;
234 QString m_currentJobInfo; // Needed if the job doesn't stop after a reasonable time. 236 QString m_currentJobInfo; // Needed if the job doesn't stop after a reasonable time.
235 bool m_bStayHidden; 237 bool m_bStayHidden;
236 protected: 238 protected:
237 virtual void reject(); 239 virtual void reject();
238 private slots: 240 private slots: