Changeset View
Changeset View
Standalone View
Standalone View
krusader/Synchronizer/synchronizertask.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Line(s) | |||||
65 | 65 | | |||
66 | void CompareTask::start() | 66 | void CompareTask::start() | ||
67 | { | 67 | { | ||
68 | if (m_state == ST_STATE_NEW) { | 68 | if (m_state == ST_STATE_NEW) { | ||
69 | m_state = ST_STATE_PENDING; | 69 | m_state = ST_STATE_PENDING; | ||
70 | m_loadFinished = m_otherLoadFinished = false; | 70 | m_loadFinished = m_otherLoadFinished = false; | ||
71 | 71 | | |||
72 | m_dirList = new SynchronizerDirList(parentWidget, ignoreHidden); | 72 | m_dirList = new SynchronizerDirList(parentWidget, ignoreHidden); | ||
73 | connect(m_dirList, SIGNAL(finished(bool)), this, SLOT(slotFinished(bool))); | 73 | connect(m_dirList, &SynchronizerDirList::finished, this, &CompareTask::slotFinished); | ||
74 | m_dirList->load(m_url, false); | 74 | m_dirList->load(m_url, false); | ||
75 | 75 | | |||
76 | if (m_duplicate) { | 76 | if (m_duplicate) { | ||
77 | m_otherDirList = new SynchronizerDirList(parentWidget, ignoreHidden); | 77 | m_otherDirList = new SynchronizerDirList(parentWidget, ignoreHidden); | ||
78 | connect(m_otherDirList, SIGNAL(finished(bool)), this, SLOT(slotOtherFinished(bool))); | 78 | connect(m_otherDirList, &SynchronizerDirList::finished, this, &CompareTask::slotOtherFinished); | ||
79 | m_otherDirList->load(m_otherUrl, false); | 79 | m_otherDirList->load(m_otherUrl, false); | ||
80 | } | 80 | } | ||
81 | } | 81 | } | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | void CompareTask::slotFinished(bool result) | 84 | void CompareTask::slotFinished(bool result) | ||
85 | { | 85 | { | ||
86 | if (!result) { | 86 | if (!result) { | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 134 | if (leftURL.isLocalFile() && rightURL.isLocalFile()) { | |||
142 | rightFile = new QFile(rightURL.path()); | 142 | rightFile = new QFile(rightURL.path()); | ||
143 | if (!rightFile->open(QIODevice::ReadOnly)) { | 143 | if (!rightFile->open(QIODevice::ReadOnly)) { | ||
144 | KMessageBox::error(parentWidget, i18n("Error at opening %1.", rightURL.path())); | 144 | KMessageBox::error(parentWidget, i18n("Error at opening %1.", rightURL.path())); | ||
145 | m_state = ST_STATE_ERROR; | 145 | m_state = ST_STATE_ERROR; | ||
146 | return; | 146 | return; | ||
147 | } | 147 | } | ||
148 | 148 | | |||
149 | timer = new QTimer(this); | 149 | timer = new QTimer(this); | ||
150 | connect(timer, SIGNAL(timeout()), this, SLOT(sendStatusMessage())); | 150 | connect(timer, &QTimer::timeout, this, &CompareContentTask::sendStatusMessage); | ||
151 | timer->setSingleShot(true); | 151 | timer->setSingleShot(true); | ||
152 | timer->start(1000); | 152 | timer->start(1000); | ||
153 | 153 | | |||
154 | localFileCompareCycle(); | 154 | localFileCompareCycle(); | ||
155 | } else { | 155 | } else { | ||
156 | leftReadJob = KIO::get(leftURL, KIO::NoReload, KIO::HideProgressInfo); | 156 | leftReadJob = KIO::get(leftURL, KIO::NoReload, KIO::HideProgressInfo); | ||
157 | rightReadJob = KIO::get(rightURL, KIO::NoReload, KIO::HideProgressInfo); | 157 | rightReadJob = KIO::get(rightURL, KIO::NoReload, KIO::HideProgressInfo); | ||
158 | 158 | | |||
159 | connect(leftReadJob, SIGNAL(data(KIO::Job*,QByteArray)), | 159 | connect(leftReadJob, &KIO::TransferJob::data, this, &CompareContentTask::slotDataReceived); | ||
160 | this, SLOT(slotDataReceived(KIO::Job*,QByteArray))); | 160 | connect(rightReadJob, &KIO::TransferJob::data, this, &CompareContentTask::slotDataReceived); | ||
161 | connect(rightReadJob, SIGNAL(data(KIO::Job*,QByteArray)), | 161 | connect(leftReadJob, &KIO::TransferJob::result, this, &CompareContentTask::slotFinished); | ||
162 | this, SLOT(slotDataReceived(KIO::Job*,QByteArray))); | 162 | connect(rightReadJob, &KIO::TransferJob::result, this, &CompareContentTask::slotFinished); | ||
163 | connect(leftReadJob, SIGNAL(result(KJob*)), | | |||
164 | this, SLOT(slotFinished(KJob*))); | | |||
165 | connect(rightReadJob, SIGNAL(result(KJob*)), | | |||
166 | this, SLOT(slotFinished(KJob*))); | | |||
167 | 163 | | |||
168 | rightReadJob->suspend(); | 164 | rightReadJob->suspend(); | ||
169 | 165 | | |||
170 | timer = new QTimer(this); | 166 | timer = new QTimer(this); | ||
171 | connect(timer, SIGNAL(timeout()), this, SLOT(sendStatusMessage())); | 167 | connect(timer, &QTimer::timeout, this, &CompareContentTask::sendStatusMessage); | ||
172 | timer->setSingleShot(true); | 168 | timer->setSingleShot(true); | ||
173 | timer->start(1000); | 169 | timer->start(1000); | ||
174 | } | 170 | } | ||
175 | } | 171 | } | ||
176 | 172 | | |||
177 | void CompareContentTask::localFileCompareCycle() | 173 | void CompareContentTask::localFileCompareCycle() | ||
178 | { | 174 | { | ||
179 | 175 | | |||
Show All 37 Lines | |||||
217 | } | 213 | } | ||
218 | 214 | | |||
219 | if (leftFile->atEnd() && rightFile->atEnd()) { | 215 | if (leftFile->atEnd() && rightFile->atEnd()) { | ||
220 | sync->compareContentResult(item, true); | 216 | sync->compareContentResult(item, true); | ||
221 | m_state = ST_STATE_READY; | 217 | m_state = ST_STATE_READY; | ||
222 | return; | 218 | return; | ||
223 | } | 219 | } | ||
224 | 220 | | |||
225 | QTimer::singleShot(0, this, SLOT(localFileCompareCycle())); | 221 | QTimer::singleShot(0, this, &CompareContentTask::localFileCompareCycle); | ||
226 | } | 222 | } | ||
227 | 223 | | |||
228 | 224 | | |||
229 | void CompareContentTask::slotDataReceived(KIO::Job *job, const QByteArray &data) | 225 | void CompareContentTask::slotDataReceived(KIO::Job *job, const QByteArray &data) | ||
230 | { | 226 | { | ||
231 | int jobowner = (job == leftReadJob) ? 1 : 0; | 227 | int jobowner = (job == leftReadJob) ? 1 : 0; | ||
232 | int bufferLen = compareArray.size(); | 228 | int bufferLen = compareArray.size(); | ||
233 | int dataLen = data.size(); | 229 | int dataLen = data.size(); | ||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |