void KaqazDesktop::setKaqazSync(KaqazSync *ksync) { p->sync = ksync; connect( p->sync, SIGNAL(syncStarted()) , SLOT(syncStarted()) ); connect( p->sync, SIGNAL(syncProgress(qreal)), SLOT(syncProgress(qreal)) ); connect( p->sync, SIGNAL(syncFinished()) , SLOT(syncFinished()) ); }
void PapyrusDesktop::setPapyrusSync(PapyrusSync *ksync) { p->sync = ksync; connect( p->sync, SIGNAL(syncStarted()) , SLOT(syncStarted()) ); connect( p->sync, SIGNAL(syncProgress(qreal)), SLOT(syncProgress(qreal)) ); connect( p->sync, SIGNAL(syncFinished()) , SLOT(syncFinished()) ); }
void CWizSync::startSync() { if (m_bSyncStarted) return; m_bSyncStarted = true; m_error = false; m_bChained = false; m_arrayAllDeletedsNeedToBeUploaded.clear(); m_arrayAllTagsNeedToBeUploaded.clear(); m_arrayAllStylesNeedToBeUploaded.clear(); m_arrayAllDocumentsNeedToBeDownloaded.clear(); m_nDocumentMaxVersion = -1; m_bDocumentInfoError = false; m_arrayAllDocumentsNeedToBeUploaded.clear(); m_currentUploadDocument = WIZDOCUMENTDATAEX(); m_arrayAllAttachmentsNeedToBeUploaded.clear(); m_currentUploadAttachment = WIZDOCUMENTATTACHMENTDATAEX(); m_arrayAllObjectsNeedToBeDownloaded.clear(); Q_EMIT syncStarted(); Q_EMIT progressChanged(progressStart); Q_EMIT processLog(tr("begin syning")); callClientLogin(m_db.getUserId(), m_db.getPassword()); }
void CWizSync::startSync() { TOLOG(tr("Begin syning")); Q_EMIT syncStarted(); m_bStarted = true; QString strUserId = m_kbSync->database()->getUserId(); QString strPasswd = m_kbSync->database()->getPassword(); m_kbSync->callClientLogin(strUserId, strPasswd); }
void HttpPoll::connectToHost(const QString &proxyHost, int proxyPort, const QUrl &url) { resetConnection(true); bool useSsl = false; d->port = 80; // using proxy? if(!proxyHost.isEmpty()) { d->host = proxyHost; d->port = proxyPort; d->url = url; d->use_proxy = true; } else { d->host = url.host(); if(url.port() != -1) d->port = url.port(); else if (url.scheme() == "https") { d->port = 443; useSsl = true; } #if QT_VERSION < 0x050000 d->url = url.path() + "?" + url.encodedQuery(); #else d->url.setUrl(url.path() + "?" + url.query(QUrl::FullyEncoded), QUrl::StrictMode); #endif d->use_proxy = false; } resetKey(); bool last; QString key = getKey(&last); #ifdef PROX_DEBUG fprintf(stderr, "HttpPoll: Connecting to %s:%d [%s]", d->host.latin1(), d->port, d->url.latin1()); if(d->user.isEmpty()) fprintf(stderr, "\n"); else fprintf(stderr, ", auth {%s,%s}\n", d->user.latin1(), d->pass.latin1()); #endif QPointer<QObject> self = this; syncStarted(); if(!self) return; d->state = 1; d->http.setUseSsl(useSsl); d->http.setAuth(d->user, d->pass); d->http.post(d->host, d->port, d->url, makePacket("0", key, "", QByteArray()), d->use_proxy); }
void ownCloudFolder::startSync(const QStringList &pathList) { if (_thread && _thread->isRunning()) { qCritical() << "* ERROR csync is still running and new sync requested."; return; } delete _csync; delete _thread; _errors.clear(); _csyncError = false; _csyncUnavail = false; _wipeDb = false; MirallConfigFile cfgFile; _syncResult.clearErrors(); // we now have watchers for everything, so every sync is remote. _syncResult.setLocalRunOnly( false ); _syncResult.setStatus( SyncResult::SyncPrepare ); emit syncStateChange(); QString url = replaceScheme(_secondPath); qDebug() << "*** Start syncing url to ownCloud: " << url; _thread = new QThread(this); _csync = new CSyncThread( path(), url); _csync->moveToThread(_thread); QList<QNetworkProxy> proxies = QNetworkProxyFactory::proxyForQuery(QUrl(cfgFile.ownCloudUrl())); // We set at least one in Application Q_ASSERT(proxies.count() > 0); QNetworkProxy proxy = proxies.first(); _csync->setConnectionDetails( CredentialStore::instance()->user(), CredentialStore::instance()->password(), proxy ); qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector"); connect( _csync, SIGNAL(treeWalkResult(const SyncFileItemVector&)), this, SLOT(slotThreadTreeWalkResult(const SyncFileItemVector&)), Qt::QueuedConnection); connect(_csync, SIGNAL(started()), SLOT(slotCSyncStarted()), Qt::QueuedConnection); connect(_csync, SIGNAL(finished()), SLOT(slotCSyncFinished()), Qt::QueuedConnection); connect(_csync, SIGNAL(csyncError(QString)), SLOT(slotCSyncError(QString)), Qt::QueuedConnection); connect(_csync, SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection); _thread->start(); QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection); emit syncStarted(); }
void EvernoteSync::startSyncThreaded() { m_storageManager->log("EvernoteSync::startSyncThreaded()"); EvernoteSyncThread *enSyncThread = new EvernoteSyncThread(m_evernoteAccess, this); connect(enSyncThread, SIGNAL(finished()), SLOT(threadFinished())); connect(enSyncThread, SIGNAL(syncFinished(bool,QString)), SIGNAL(syncFinished(bool,QString))); connect(enSyncThread, SIGNAL(loginError(QString)), SIGNAL(loginError(QString))); connect(enSyncThread, SIGNAL(firstChunkDone()), SIGNAL(firstChunkDone())); connect(enSyncThread, SIGNAL(syncProgressChanged(int)), SLOT(updateSyncProgress(int))); connect(enSyncThread, SIGNAL(syncStatusMessage(QString)), SLOT(updateSyncStatusMessage(QString))); connect(enSyncThread, SIGNAL(fullSyncDoneChanged()), SIGNAL(fullSyncDoneChanged())); connect(enSyncThread, SIGNAL(authTokenInvalid()), SIGNAL(authTokenInvalid())); connect(enSyncThread, SIGNAL(rateLimitReached(int)), SLOT(rateLimitReached(int))); updateSyncStatusMessage("Starting sync"); enSyncThread->start(QThread::LowPriority); emit syncStarted(); }
void HttpPoll::do_sync() { if(d->http.isActive()) return; d->t->stop(); d->out = takeWrite(0, false); bool last; QString key = getKey(&last); QString newkey; if(last) { resetKey(); newkey = getKey(&last); } QPointer<QObject> self = this; syncStarted(); if(!self) return; d->http.post(d->host, d->port, d->url, makePacket(d->ident, key, newkey, d->out), d->use_proxy); }
void Folder::startSync(const QStringList &pathList) { Q_ASSERT(_accountState); Q_UNUSED(pathList) if (!_csync_ctx) { // no _csync_ctx yet, initialize it. init(); if (!_csync_ctx) { qDebug() << Q_FUNC_INFO << "init failed."; // the error should already be set QMetaObject::invokeMethod(this, "slotSyncFinished", Qt::QueuedConnection); return; } } else if (proxyDirty()) { setProxyDirty(false); } csync_set_log_level( Logger::instance()->isNoop() ? 0 : 11 ); if (isBusy()) { qCritical() << "* ERROR csync is still running and new sync requested."; return; } _errors.clear(); _csyncError = false; _csyncUnavail = false; _timeSinceLastSyncStart.restart(); _syncResult.clearErrors(); _syncResult.setStatus( SyncResult::SyncPrepare ); _syncResult.setSyncFileItemVector(SyncFileItemVector()); emit syncStateChange(); qDebug() << "*** Start syncing " << alias() << " - client version" << qPrintable(Theme::instance()->version()); if (! setIgnoredFiles()) { slotSyncError(tr("Could not read system exclude file")); QMetaObject::invokeMethod(this, "slotSyncFinished", Qt::QueuedConnection); return; } // pass the setting if hidden files are to be ignored, will be read in csync_update _csync_ctx->ignore_hidden_files = _definition.ignoreHiddenFiles; _engine.reset(new SyncEngine( _accountState->account(), _csync_ctx, path(), remoteUrl().path(), remotePath(), &_journal)); qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector"); qRegisterMetaType<SyncFileItem::Direction>("SyncFileItem::Direction"); connect(_engine.data(), SIGNAL(rootEtag(QString)), this, SLOT(etagRetreivedFromSyncEngine(QString))); connect( _engine.data(), SIGNAL(treeWalkResult(const SyncFileItemVector&)), this, SLOT(slotThreadTreeWalkResult(const SyncFileItemVector&)), Qt::QueuedConnection); connect( _engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)), this, SLOT(slotAboutToPropagate(SyncFileItemVector&))); connect(_engine.data(), SIGNAL(started()), SLOT(slotSyncStarted()), Qt::QueuedConnection); connect(_engine.data(), SIGNAL(finished(bool)), SLOT(slotSyncFinished(bool)), Qt::QueuedConnection); connect(_engine.data(), SIGNAL(csyncError(QString)), SLOT(slotSyncError(QString)), Qt::QueuedConnection); connect(_engine.data(), SIGNAL(csyncUnavailable()), SLOT(slotCsyncUnavailable()), Qt::QueuedConnection); //direct connection so the message box is blocking the sync. connect(_engine.data(), SIGNAL(aboutToRemoveAllFiles(SyncFileItem::Direction,bool*)), SLOT(slotAboutToRemoveAllFiles(SyncFileItem::Direction,bool*))); connect(_engine.data(), SIGNAL(folderDiscovered(bool,QString)), this, SLOT(slotFolderDiscovered(bool,QString))); connect(_engine.data(), SIGNAL(transmissionProgress(ProgressInfo)), this, SLOT(slotTransmissionProgress(ProgressInfo))); connect(_engine.data(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)), this, SLOT(slotItemCompleted(const SyncFileItem &, const PropagatorJob &))); connect(_engine.data(), SIGNAL(syncItemDiscovered(const SyncFileItem &)), this, SLOT(slotSyncItemDiscovered(const SyncFileItem &))); connect(_engine.data(), SIGNAL(newBigFolder(QString)), this, SLOT(slotNewBigFolderDiscovered(QString))); setDirtyNetworkLimits(); ConfigFile cfgFile; auto newFolderLimit = cfgFile.newBigFolderSizeLimit(); quint64 limit = newFolderLimit.first ? newFolderLimit.second * 1000 * 1000 : -1; // convert from MB to B _engine->setNewBigFolderSizeLimit(limit); QMetaObject::invokeMethod(_engine.data(), "startSync", Qt::QueuedConnection); // disable events until syncing is done // _watcher->setEventsEnabled(false); emit syncStarted(); }
void GitFolder::startSync() { QMutexLocker locker(&_syncMutex); emit syncStarted(); emit syncFinished(SyncResult(SyncResult::Success)); }
void EvernoteSession::sync(){ if(syncInProgress){ return; } syncInProgress = true; syncCancelled = false; try{ for(int i=0;i<5;i++){ try{ recreateUserStoreClient(false); recreateSyncClient(false); qDebug() << "EvernoteSession :: start sync..."; int cacheUsn = DatabaseManager::instance()->getIntSetting(SettingsKeys::SERVER_USN); qDebug() << "EvernoteSession :: saved USN: " << cacheUsn; SyncChunk chunk; int percent = 0; while(true){ syncStarted(percent); syncClient->getSyncChunk(chunk, Settings::instance()->getAuthToken().toStdString(), cacheUsn, 1024, false); if(cacheUsn >= chunk.updateCount){ break; } percent = (int)((double)(100* (double)cacheUsn/(double)chunk.updateCount)); syncStarted(percent); std::vector <Tag> tags = chunk.tags; if(!tags.empty()){ tagsSyncStarted(); DatabaseManager::instance()->beginTransacton(); for(int i=0;i<tags.size();i++){ if(syncCancelled){ syncCancelled = false; syncInProgress = false; syncFinished(); return; } Tag tag = tags.at(i); DatabaseManager::instance()->saveTag(tag); qDebug() << "EvernoteSession :: tag " << tag.name.c_str(); } DatabaseManager::instance()->commitTransaction(); } syncStarted(percent); if(syncCancelled){ syncCancelled = false; syncInProgress = false; syncFinished(); return; } std::vector <Notebook> notebooks = chunk.notebooks; qDebug() << "EvernoteSession :: notebooks " << chunk.notebooks.size(); if(!notebooks.empty()){ notebooksSyncStarted(); DatabaseManager::instance()->beginTransacton(); for(int i=0;i<notebooks.size();i++){ if(syncCancelled){ syncCancelled = false; syncInProgress = false; syncFinished(); return; } Notebook notebook = notebooks.at(i); DatabaseManager::instance()->saveNotebook(notebook); qDebug() << "EvernoteSession :: notebook " << notebook.name.c_str(); } DatabaseManager::instance()->commitTransaction(); } syncStarted(percent); if(syncCancelled){ syncCancelled = false; syncInProgress = false; syncFinished(); return; } std::vector <Note> notes = chunk.notes; qDebug() << "EvernoteSession :: notes " << chunk.notes.size(); if(!notes.empty()){ DatabaseManager::instance()->beginTransacton(); for(int i=0;i<notes.size();i++){ if(syncCancelled){ syncCancelled = false; syncInProgress = false; syncFinished(); return; } Note note = notes.at(i); if(note.deleted){ DatabaseManager::instance()->deleteNote(note); }else{ DatabaseManager::instance()->saveNote(note); } qDebug() << "EvernoteSession :: note " << note.title.c_str(); } DatabaseManager::instance()->commitTransaction(); } syncStarted(percent); std::vector <SavedSearch> searches = chunk.searches; qDebug() << "EvernoteSession :: searches " << chunk.searches.size(); if(!searches.empty()) { DatabaseManager::instance()->beginTransacton(); for(int i=0; i < searches.size(); i++) { SavedSearch search = searches.at(i); DatabaseManager::instance()->saveSavedSearch(search); qDebug() << "EvernoteSession :: search " << search.name.c_str(); } DatabaseManager::instance()->commitTransaction(); } syncStarted(percent); qDebug() << "expunged notes: " << chunk.expungedNotes.size(); cacheUsn = chunk.chunkHighUSN; DatabaseManager::instance()->beginTransacton(); DatabaseManager::instance()->makeIntSetting(SettingsKeys::SERVER_USN, cacheUsn); DatabaseManager::instance()->commitTransaction(); if(cacheUsn >= chunk.updateCount){ break; } qDebug() << "Current usn: " << cacheUsn << " high usn: " << chunk.chunkHighUSN << ", update count: " << chunk.updateCount; } qDebug() << "EvernoteSession :: sync finished"; break; }catch(EDAMSystemException &e){ qDebug() << "EvernoteSession :: Edam SYSTEM EXCEPTION " << e.what() << " " << e.errorCode; if(e.errorCode == 9){ reauth(); } } } }catch(TException &tx){ qDebug() << "EvernoteSession :: excetion while sync: " << tx.what(); syncFailed("Network error"); } syncInProgress = false; syncFinished(); Cache::instance()->load(); }
void ownCloudFolder::slotCSyncStarted() { qDebug() << " * csync thread started"; emit syncStarted(); }