Skip to content

Commit e29b216

Browse files
authored
Merge branch 'master' into bugfix/unmessify-UnifiedSearchResultNothingFound
2 parents 69e419c + 926256d commit e29b216

7 files changed

Lines changed: 26 additions & 7 deletions

File tree

src/gui/folderman.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,12 @@ void FolderMan::scheduleFolder(Folder *f)
643643
startScheduledSyncSoon();
644644
}
645645

646+
void FolderMan::scheduleFolderForImmediateSync(Folder *f)
647+
{
648+
_nextSyncShouldStartImmediately = true;
649+
scheduleFolder(f);
650+
}
651+
646652
void FolderMan::scheduleFolderNext(Folder *f)
647653
{
648654
auto alias = f->alias();
@@ -792,6 +798,12 @@ void FolderMan::startScheduledSyncSoon()
792798
// Time since the last sync run counts against the delay
793799
msDelay = qMax(1ll, msDelay - msSinceLastSync);
794800

801+
if (_nextSyncShouldStartImmediately) {
802+
_nextSyncShouldStartImmediately = false;
803+
qCInfo(lcFolderMan) << "Next sync is marked to start immediately, so setting the delay to '0'";
804+
msDelay = 0;
805+
}
806+
795807
qCInfo(lcFolderMan) << "Starting the next scheduled sync in" << (msDelay / 1000) << "seconds";
796808
_startScheduledSyncTimer.start(msDelay);
797809
}

src/gui/folderman.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ class FolderMan : public QObject
193193
/** Queues a folder for syncing. */
194194
void scheduleFolder(Folder *);
195195

196+
/** Queues a folder for syncing that starts immediately. */
197+
void scheduleFolderForImmediateSync(Folder *);
198+
196199
/** Puts a folder in the very front of the queue. */
197200
void scheduleFolderNext(Folder *);
198201

@@ -357,6 +360,8 @@ private slots:
357360
/// Picks the next scheduled folder and starts the sync
358361
QTimer _startScheduledSyncTimer;
359362

363+
bool _nextSyncShouldStartImmediately = false;
364+
360365
QScopedPointer<SocketApi> _socketApi;
361366
NavigationPaneHelper _navigationPaneHelper;
362367

src/gui/folderstatusmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ void FolderStatusModel::slotApplySelectiveSync()
931931
folder->journalDb()->schedulePathForRemoteDiscovery(it);
932932
folder->schedulePathForLocalDiscovery(it);
933933
}
934-
FolderMan::instance()->scheduleFolder(folder);
934+
FolderMan::instance()->scheduleFolderForImmediateSync(folder);
935935
}
936936
}
937937

src/gui/selectivesyncdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ void SelectiveSyncDialog::accept()
544544
_folder->schedulePathForLocalDiscovery(it);
545545
}
546546

547-
folderMan->scheduleFolder(_folder);
547+
folderMan->scheduleFolderForImmediateSync(_folder);
548548
}
549549
QDialog::accept();
550550
}

src/libsync/owncloudpropagator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,8 @@ void OwncloudPropagator::start(SyncFileItemVector &&items)
482482
{
483483
Q_ASSERT(std::is_sorted(items.begin(), items.end()));
484484

485+
_abortRequested = false;
486+
485487
/* This builds all the jobs needed for the propagation.
486488
* Each directory is a PropagateDirectory job, which contains the files in it.
487489
* In order to do that we loop over the items. (which are sorted by destination)

src/libsync/owncloudpropagator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
538538
{
539539
if (_abortRequested)
540540
return;
541+
542+
_abortRequested = true;
541543
if (_rootJob) {
542544
// Connect to abortFinished which signals that abort has been asynchronously finished
543545
connect(_rootJob.data(), &PropagateDirectory::abortFinished, this, &OwncloudPropagator::emitFinished);
@@ -633,6 +635,7 @@ private slots:
633635
{
634636
if (!_finishedEmited)
635637
emit finished(status == SyncFileItem::Success);
638+
_abortRequested = false;
636639
_finishedEmited = true;
637640
}
638641

src/libsync/syncengine.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,19 +1056,16 @@ void SyncEngine::switchToVirtualFiles(const QString &localPath, SyncJournalDb &j
10561056

10571057
void SyncEngine::abort()
10581058
{
1059-
if (_propagator)
1060-
qCInfo(lcEngine) << "Aborting sync";
1061-
10621059
if (_propagator) {
10631060
// If we're already in the propagation phase, aborting that is sufficient
1061+
qCInfo(lcEngine) << "Aborting sync in propagator...";
10641062
_propagator->abort();
10651063
} else if (_discoveryPhase) {
10661064
// Delete the discovery and all child jobs after ensuring
10671065
// it can't finish and start the propagator
10681066
disconnect(_discoveryPhase.data(), nullptr, this, nullptr);
10691067
_discoveryPhase.take()->deleteLater();
1070-
1071-
Q_EMIT syncError(tr("Synchronization will resume shortly."));
1068+
qCInfo(lcEngine) << "Aborting sync in discovery...";
10721069
finalize(false);
10731070
}
10741071
}

0 commit comments

Comments
 (0)