зеркало из https://github.com/nextcloud/desktop.git
- fixed local file change detection in win poller
- fixed context menu at startup.
This commit is contained in:
Родитель
3fb471edad
Коммит
8e637bd8c7
|
@ -85,7 +85,16 @@ Application::Application(int argc, char **argv) :
|
|||
setQuitOnLastWindowClosed(false);
|
||||
|
||||
_folderWizard = new FolderWizard( 0, _theme );
|
||||
|
||||
_ocInfo = new ownCloudInfo( QString(), this );
|
||||
connect( _ocInfo,SIGNAL(ownCloudInfoFound(QString,QString)),
|
||||
SLOT(slotOwnCloudFound(QString,QString)));
|
||||
|
||||
connect( _ocInfo,SIGNAL(noOwncloudFound(QNetworkReply::NetworkError)),
|
||||
SLOT(slotNoOwnCloudFound(QNetworkReply::NetworkError)));
|
||||
|
||||
_owncloudSetupWizard = new OwncloudSetupWizard( _folderMan, _theme );
|
||||
connect( _owncloudSetupWizard, SIGNAL(ownCloudWizardDone(int)), SLOT(slotStartFolderSetup()));
|
||||
|
||||
_statusDialog = new StatusDialog( _theme );
|
||||
connect( _statusDialog, SIGNAL(addASync()), this, SLOT(slotAddFolder()) );
|
||||
|
@ -131,14 +140,7 @@ Application::~Application()
|
|||
|
||||
void Application::slotStartFolderSetup()
|
||||
{
|
||||
_ocInfo = new ownCloudInfo( QString(), this );
|
||||
|
||||
if( _ocInfo->isConfigured() ) {
|
||||
connect( _ocInfo,SIGNAL(ownCloudInfoFound(QString,QString)),
|
||||
SLOT(slotOwnCloudFound(QString,QString)));
|
||||
connect( _ocInfo,SIGNAL(noOwncloudFound(QNetworkReply::NetworkError)),
|
||||
SLOT(slotNoOwnCloudFound(QNetworkReply::NetworkError)));
|
||||
|
||||
_ocInfo->checkInstallation();
|
||||
} else {
|
||||
slotNoOwnCloudFound( QNetworkReply::UnknownNetworkError );
|
||||
|
@ -155,6 +157,8 @@ void Application::slotOwnCloudFound( const QString& url , const QString& version
|
|||
if( _tray )
|
||||
_tray->showMessage(tr("ownCloud Sync Started"), tr("Sync started for %1 configured sync folder(s).").arg(cnt));
|
||||
}
|
||||
_actionAddFolder->setEnabled( true );
|
||||
|
||||
setupContextMenu();
|
||||
}
|
||||
|
||||
|
@ -163,7 +167,8 @@ void Application::slotNoOwnCloudFound( QNetworkReply::NetworkError err )
|
|||
qDebug() << "** Application: NO ownCloud found!";
|
||||
QMessageBox::warning(0, tr("No ownCloud Connection"),
|
||||
tr("There is no ownCloud connection available. Please configure one by clicking on the tray icon!"));
|
||||
|
||||
_actionAddFolder->setEnabled( false );
|
||||
setupContextMenu();
|
||||
}
|
||||
|
||||
void Application::slotHideSplash()
|
||||
|
@ -191,8 +196,6 @@ void Application::setupSystemTray()
|
|||
connect(_tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||
SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)));
|
||||
|
||||
// setupContextMenu();
|
||||
|
||||
_tray->show();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
namespace Mirall {
|
||||
|
||||
#define POLL_TIMER_EXCEED 10
|
||||
|
||||
ownCloudFolder::ownCloudFolder(const QString &alias,
|
||||
const QString &path,
|
||||
const QString &secondPath,
|
||||
|
@ -36,6 +38,7 @@ ownCloudFolder::ownCloudFolder(const QString &alias,
|
|||
: Folder(alias, path, secondPath, parent)
|
||||
, _secondPath(secondPath)
|
||||
, _localCheckOnly( false )
|
||||
, _localFileChanges( false )
|
||||
, _csync(0)
|
||||
, _pollTimerCnt(0)
|
||||
, _csyncError(false)
|
||||
|
@ -66,13 +69,8 @@ ownCloudFolder::~ownCloudFolder()
|
|||
#ifndef USE_WATCHER
|
||||
void ownCloudFolder::slotPollTimerRemoteCheck()
|
||||
{
|
||||
_localCheckOnly = true;
|
||||
_pollTimerCnt++;
|
||||
if( _pollTimerCnt == 15 ) {
|
||||
_pollTimerCnt = 0;
|
||||
_localCheckOnly = false;
|
||||
}
|
||||
qDebug() << "**** CSyncFolder Poll Timer check: " << _pollTimerCnt << " - " << _localCheckOnly;
|
||||
qDebug() << "**** Poll Timer Cnt increase: " << _pollTimerCnt;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -113,9 +111,20 @@ void ownCloudFolder::startSync(const QStringList &pathList)
|
|||
|
||||
QUrl url( _secondPath );
|
||||
url.setScheme( "owncloud" );
|
||||
#ifdef USE_WATCHER
|
||||
// if there is a watcher and no polling, ever sync is remote.
|
||||
_localCheckOnly = false;
|
||||
#else
|
||||
_localCheckOnly = true;
|
||||
if( _pollTimerCnt == POLL_TIMER_EXCEED || _localFileChanges ) {
|
||||
_localCheckOnly = false;
|
||||
_pollTimerCnt = 0;
|
||||
_localFileChanges = false;
|
||||
}
|
||||
#endif
|
||||
qDebug() << "*** Start syncing to ownCloud, onlyLocal: " << _localCheckOnly;
|
||||
|
||||
_csync = new CSyncThread(path(), url.toEncoded(), _localCheckOnly );
|
||||
_csync = new CSyncThread( path(), url.toEncoded(), _localCheckOnly );
|
||||
_csync->setUserPwd( cfgFile.ownCloudUser(), cfgFile.ownCloudPasswd() );
|
||||
QObject::connect(_csync, SIGNAL(started()), SLOT(slotCSyncStarted()));
|
||||
QObject::connect(_csync, SIGNAL(finished()), SLOT(slotCSyncFinished()));
|
||||
|
@ -145,22 +154,24 @@ void ownCloudFolder::slotThreadTreeWalkResult( WalkStats *wStats )
|
|||
qDebug() << "Removed files: " << wStats->removed;
|
||||
qDebug() << "Renamed files: " << wStats->renamed;
|
||||
|
||||
if( ! _localCheckOnly ) _lastSeenFiles = 0;
|
||||
_localFileChanges = false;
|
||||
|
||||
#ifndef USE_WATCHER
|
||||
if( _lastSeenFiles > 0 && _lastSeenFiles != wStats->seenFiles ) {
|
||||
qDebug() << "*** last seen files different from currently seen number => full Sync needed";
|
||||
_localCheckOnly = false;
|
||||
_pollTimerCnt = 0;
|
||||
qDebug() << "*** last seen files different from currently seen number " << _lastSeenFiles << "<>" << wStats->seenFiles << " => full Sync needed";
|
||||
_localFileChanges = true;
|
||||
}
|
||||
if( _localCheckOnly && (wStats->newFiles + wStats->eval + wStats->removed + wStats->renamed) > 0 ) {
|
||||
if( (wStats->newFiles + wStats->eval + wStats->removed + wStats->renamed) > 0 ) {
|
||||
qDebug() << "*** Local changes, lets do a full sync!" ;
|
||||
_localCheckOnly = false; // next time it will be a non local check.
|
||||
_pollTimerCnt = 0;
|
||||
_localFileChanges = true;
|
||||
}
|
||||
if( _localCheckOnly ) {
|
||||
if( _pollTimerCnt < POLL_TIMER_EXCEED ) {
|
||||
qDebug() << " *** No local changes, finalize, pollTimerCounter is "<< _pollTimerCnt ;
|
||||
}
|
||||
#endif
|
||||
_lastSeenFiles = wStats->seenFiles;
|
||||
|
||||
/*
|
||||
* Attention: This is deleted here, outside of the thread, because the thread can
|
||||
* faster die than this routine has read out the memory.
|
||||
|
@ -192,9 +203,11 @@ void ownCloudFolder::slotCSyncFinished()
|
|||
res.setErrorStrings( _errors );
|
||||
qDebug() << " * owncloud csync thread finished with error";
|
||||
} else {
|
||||
qDebug() << " * owncloud csync thread finished successfully";
|
||||
qDebug() << " * owncloud csync thread finished successfully " << _localCheckOnly;
|
||||
}
|
||||
|
||||
if( ! _localCheckOnly ) _lastSeenFiles = 0;
|
||||
|
||||
emit syncFinished( res );
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ private:
|
|||
QString _secondPath;
|
||||
CSyncThread *_csync;
|
||||
bool _localCheckOnly;
|
||||
bool _localFileChanges;
|
||||
int _pollTimerCnt;
|
||||
QStringList _errors;
|
||||
bool _csyncError;
|
||||
|
|
|
@ -64,6 +64,8 @@ OwncloudSetupWizard::OwncloudSetupWizard( FolderMan *folderMan, Theme *theme, QO
|
|||
connect( _ocWizard, SIGNAL(installOCLocalhost()),
|
||||
this, SLOT(slotCreateOCLocalhost()));
|
||||
|
||||
connect( _ocWizard, SIGNAL(finished(int)),this,SIGNAL(ownCloudWizardDone(int)));
|
||||
|
||||
// in case of cancel, terminate the owncloud-admin script.
|
||||
connect( _ocWizard, SIGNAL(rejected()), _process, SLOT(terminate()));
|
||||
|
||||
|
|
|
@ -54,7 +54,10 @@ public:
|
|||
OwncloudWizard *wizard();
|
||||
|
||||
signals:
|
||||
// issued if the oC Setup process (owncloud-admin) is finished.
|
||||
void ownCloudSetupFinished( bool );
|
||||
// overall dialog close signal.
|
||||
void ownCloudWizardDone( int );
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче