Changeset View
Changeset View
Standalone View
Standalone View
iso/iso.cpp
Show All 33 Lines | |||||
34 | #include <QMimeDatabase> | 34 | #include <QMimeDatabase> | ||
35 | #include <QMimeType> | 35 | #include <QMimeType> | ||
36 | #include <qplatformdefs.h> | 36 | #include <qplatformdefs.h> | ||
37 | 37 | | |||
38 | #include "libisofs/iso_fs.h" | 38 | #include "libisofs/iso_fs.h" | ||
39 | #include "kiso.h" | 39 | #include "kiso.h" | ||
40 | #include "kisofile.h" | 40 | #include "kisofile.h" | ||
41 | #include "kisodirectory.h" | 41 | #include "kisodirectory.h" | ||
42 | #include "../krusader/compat.h" | ||||
42 | 43 | | |||
43 | using namespace KIO; | 44 | using namespace KIO; | ||
44 | extern "C" | 45 | extern "C" | ||
45 | { | 46 | { | ||
46 | 47 | | |||
47 | int Q_DECL_EXPORT kdemain(int argc, char **argv) { | 48 | int Q_DECL_EXPORT kdemain(int argc, char **argv) { | ||
48 | //qDebug() << "Starting " << getpid() << endl; | 49 | //qDebug() << "Starting " << getpid() << endl; | ||
49 | 50 | | |||
▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Line(s) | 90 | { | |||
180 | 181 | | |||
181 | return true; | 182 | return true; | ||
182 | } | 183 | } | ||
183 | 184 | | |||
184 | 185 | | |||
185 | void kio_isoProtocol::createUDSEntry(const KArchiveEntry * isoEntry, UDSEntry & entry) | 186 | void kio_isoProtocol::createUDSEntry(const KArchiveEntry * isoEntry, UDSEntry & entry) | ||
186 | { | 187 | { | ||
187 | entry.clear(); | 188 | entry.clear(); | ||
188 | entry.insert(UDSEntry::UDS_NAME, isoEntry->name()); | 189 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_NAME, isoEntry->name()); | ||
189 | entry.insert(UDSEntry::UDS_FILE_TYPE, isoEntry->permissions() & S_IFMT); // keep file type only | 190 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_FILE_TYPE, isoEntry->permissions() & S_IFMT); // keep file type only | ||
nmel: Check major version too. This will break with 6.0 release. | |||||
190 | entry.insert(UDSEntry::UDS_ACCESS, isoEntry->permissions() & 07777); // keep permissions only | 191 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_ACCESS, isoEntry->permissions() & 07777); // keep permissions only | ||
191 | 192 | | |||
192 | if (isoEntry->isFile()) { | 193 | if (isoEntry->isFile()) { | ||
193 | long long si = ((KIsoFile *)isoEntry)->realsize(); | 194 | long long si = ((KIsoFile *)isoEntry)->realsize(); | ||
194 | if (!si) si = ((KIsoFile *)isoEntry)->size(); | 195 | if (!si) si = ((KIsoFile *)isoEntry)->size(); | ||
195 | entry.insert(UDSEntry::UDS_SIZE, si); | 196 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_SIZE, si); | ||
196 | } else { | 197 | } else { | ||
197 | entry.insert(UDSEntry::UDS_SIZE, 0L); | 198 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_SIZE, 0L); | ||
198 | } | 199 | } | ||
199 | 200 | | |||
200 | entry.insert(UDSEntry::UDS_USER, isoEntry->user()); | 201 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_USER, isoEntry->user()); | ||
201 | entry.insert(UDSEntry::UDS_GROUP, isoEntry->group()); | 202 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_GROUP, isoEntry->group()); | ||
202 | entry.insert((uint)UDSEntry::UDS_MODIFICATION_TIME, isoEntry->date().toTime_t()); | 203 | entry.UDS_ENTRY_INSERT((uint)UDSEntry::UDS_MODIFICATION_TIME, isoEntry->date().toTime_t()); | ||
203 | entry.insert(UDSEntry::UDS_ACCESS_TIME, | 204 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_ACCESS_TIME, | ||
204 | isoEntry->isFile() ? ((KIsoFile *)isoEntry)->adate() : | 205 | isoEntry->isFile() ? ((KIsoFile *)isoEntry)->adate() : | ||
205 | ((KIsoDirectory *)isoEntry)->adate()); | 206 | ((KIsoDirectory *)isoEntry)->adate()); | ||
206 | 207 | | |||
207 | entry.insert(UDSEntry::UDS_CREATION_TIME, | 208 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_CREATION_TIME, | ||
208 | isoEntry->isFile() ? ((KIsoFile *)isoEntry)->cdate() : | 209 | isoEntry->isFile() ? ((KIsoFile *)isoEntry)->cdate() : | ||
209 | ((KIsoDirectory *)isoEntry)->cdate()); | 210 | ((KIsoDirectory *)isoEntry)->cdate()); | ||
210 | 211 | | |||
211 | entry.insert(UDSEntry::UDS_LINK_DEST, isoEntry->symLinkTarget()); | 212 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_LINK_DEST, isoEntry->symLinkTarget()); | ||
212 | } | 213 | } | ||
213 | 214 | | |||
214 | void kio_isoProtocol::listDir(const QUrl &url) | 215 | void kio_isoProtocol::listDir(const QUrl &url) | ||
215 | { | 216 | { | ||
216 | //qDebug() << "kio_isoProtocol::listDir " << url.url() << endl; | 217 | //qDebug() << "kio_isoProtocol::listDir " << url.url() << endl; | ||
217 | 218 | | |||
218 | QString path; | 219 | QString path; | ||
219 | if (!checkNewFile(getPath(url), path, url.hasFragment() ? url.fragment(QUrl::FullyDecoded).toInt() : -1)) { | 220 | if (!checkNewFile(getPath(url), path, url.hasFragment() ? url.fragment(QUrl::FullyDecoded).toInt() : -1)) { | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 297 | if (!checkNewFile(getPath(url), path, url.hasFragment() ? url.fragment(QUrl::FullyDecoded).toInt() : -1)) { | |||
300 | //qDebug() << "kio_isoProtocol::stat (stat) on " << _path << endl; | 301 | //qDebug() << "kio_isoProtocol::stat (stat) on " << _path << endl; | ||
301 | QT_STATBUF buff; | 302 | QT_STATBUF buff; | ||
302 | if (QT_STAT(_path.data(), &buff) == -1 || !S_ISDIR(buff.st_mode)) { | 303 | if (QT_STAT(_path.data(), &buff) == -1 || !S_ISDIR(buff.st_mode)) { | ||
303 | //qDebug() << "isdir=" << S_ISDIR(buff.st_mode) << " errno=" << strerror(errno) << endl; | 304 | //qDebug() << "isdir=" << S_ISDIR(buff.st_mode) << " errno=" << strerror(errno) << endl; | ||
304 | error(KIO::ERR_DOES_NOT_EXIST, getPath(url)); | 305 | error(KIO::ERR_DOES_NOT_EXIST, getPath(url)); | ||
305 | return; | 306 | return; | ||
306 | } | 307 | } | ||
307 | // Real directory. Return just enough information for KRun to work | 308 | // Real directory. Return just enough information for KRun to work | ||
308 | entry.insert(UDSEntry::UDS_NAME, url.fileName()); | 309 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_NAME, url.fileName()); | ||
309 | //qDebug() << "kio_isoProtocol::stat returning name=" << url.fileName() << endl; | 310 | //qDebug() << "kio_isoProtocol::stat returning name=" << url.fileName() << endl; | ||
310 | 311 | | |||
311 | entry.insert(UDSEntry::UDS_FILE_TYPE, buff.st_mode & S_IFMT); | 312 | entry.UDS_ENTRY_INSERT(UDSEntry::UDS_FILE_TYPE, buff.st_mode & S_IFMT); | ||
312 | 313 | | |||
313 | statEntry(entry); | 314 | statEntry(entry); | ||
314 | 315 | | |||
315 | finished(); | 316 | finished(); | ||
316 | 317 | | |||
317 | // And let go of the iso file - for people who want to unmount a cdrom after that | 318 | // And let go of the iso file - for people who want to unmount a cdrom after that | ||
318 | delete m_isoFile; | 319 | delete m_isoFile; | ||
319 | m_isoFile = 0L; | 320 | m_isoFile = 0L; | ||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |
Check major version too. This will break with 6.0 release.