Changeset View
Changeset View
Standalone View
Standalone View
src/core/mkpathjob.cpp
Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Line(s) | 34 | public: | |||
---|---|---|---|---|---|
83 | 83 | | |||
84 | static inline MkpathJob *newJob(const QUrl &url, const QUrl &baseUrl, JobFlags flags) | 84 | static inline MkpathJob *newJob(const QUrl &url, const QUrl &baseUrl, JobFlags flags) | ||
85 | { | 85 | { | ||
86 | MkpathJob *job = new MkpathJob(*new MkpathJobPrivate(url, baseUrl, flags)); | 86 | MkpathJob *job = new MkpathJob(*new MkpathJobPrivate(url, baseUrl, flags)); | ||
87 | job->setUiDelegate(KIO::createDefaultJobUiDelegate()); | 87 | job->setUiDelegate(KIO::createDefaultJobUiDelegate()); | ||
88 | if (!(flags & HideProgressInfo)) { | 88 | if (!(flags & HideProgressInfo)) { | ||
89 | KIO::getJobTracker()->registerJob(job); | 89 | KIO::getJobTracker()->registerJob(job); | ||
90 | } | 90 | } | ||
91 | if (!(flags & NoPrivilegeExecution)) { | ||||
92 | job->d_func()->m_privilegeExecutionEnabled = true; | ||||
93 | job->d_func()->m_operationType = MkDir; | ||||
94 | } | ||||
91 | return job; | 95 | return job; | ||
92 | } | 96 | } | ||
93 | 97 | | |||
94 | }; | 98 | }; | ||
95 | 99 | | |||
96 | MkpathJob::MkpathJob(MkpathJobPrivate &dd) | 100 | MkpathJob::MkpathJob(MkpathJobPrivate &dd) | ||
97 | : Job(dd) | 101 | : Job(dd) | ||
98 | { | 102 | { | ||
99 | QTimer::singleShot(0, this, SLOT(slotStart())); | 103 | QTimer::singleShot(0, this, SLOT(slotStart())); | ||
100 | } | 104 | } | ||
101 | 105 | | |||
102 | MkpathJob::~MkpathJob() | 106 | MkpathJob::~MkpathJob() | ||
103 | { | 107 | { | ||
104 | } | 108 | } | ||
105 | 109 | | |||
106 | void MkpathJobPrivate::slotStart() | 110 | void MkpathJobPrivate::slotStart() | ||
107 | { | 111 | { | ||
108 | Q_Q(MkpathJob); | 112 | Q_Q(MkpathJob); | ||
109 | | ||||
110 | if (m_pathIterator == m_pathComponents.constBegin()) { // first time: emit total | 113 | if (m_pathIterator == m_pathComponents.constBegin()) { // first time: emit total | ||
111 | q->setTotalAmount(KJob::Directories, m_pathComponents.count()); | 114 | q->setTotalAmount(KJob::Directories, m_pathComponents.count()); | ||
112 | } | 115 | } | ||
113 | 116 | | |||
114 | if (m_pathIterator != m_pathComponents.constEnd()) { | 117 | if (m_pathIterator != m_pathComponents.constEnd()) { | ||
115 | m_url.setPath(m_url.path() + '/' + *m_pathIterator); | 118 | m_url.setPath(m_url.path() + '/' + *m_pathIterator); | ||
116 | KIO::Job* job = KIO::mkdir(m_url); | 119 | KIO::Job* job = KIO::mkdir(m_url); | ||
120 | job->setParentJob(q); | ||||
117 | q->addSubjob(job); | 121 | q->addSubjob(job); | ||
118 | q->setProcessedAmount(KJob::Directories, q->processedAmount(KJob::Directories) + 1); | 122 | q->setProcessedAmount(KJob::Directories, q->processedAmount(KJob::Directories) + 1); | ||
119 | } else { | 123 | } else { | ||
120 | q->emitResult(); | 124 | q->emitResult(); | ||
121 | } | 125 | } | ||
122 | } | 126 | } | ||
123 | 127 | | |||
124 | void MkpathJob::slotResult(KJob *job) | 128 | void MkpathJob::slotResult(KJob *job) | ||
125 | { | 129 | { | ||
126 | Q_D(MkpathJob); | 130 | Q_D(MkpathJob); | ||
127 | if (job->error() && job->error() != KIO::ERR_DIR_ALREADY_EXIST) { | 131 | if (job->error() && job->error() != KIO::ERR_DIR_ALREADY_EXIST) { | ||
dfaure: revert unnecessary newline changes to this file | |||||
128 | KIO::Job::slotResult(job); // will set the error and emit result(this) | 132 | KIO::Job::slotResult(job); // will set the error and emit result(this) | ||
129 | return; | 133 | return; | ||
130 | } | 134 | } | ||
131 | removeSubjob(job); | 135 | removeSubjob(job); | ||
132 | 136 | | |||
133 | emit directoryCreated(d->m_url); | 137 | emit directoryCreated(d->m_url); | ||
134 | 138 | | |||
135 | // Move on to next one | 139 | // Move on to next one | ||
Show All 11 Lines |
revert unnecessary newline changes to this file