mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2026-04-09 15:13:06 +02:00
Compare commits
11 Commits
techprevie
...
techprevie
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1667f48d3 | ||
|
|
33f9ae827f | ||
|
|
ef4541f834 | ||
|
|
1b6a9bf128 | ||
|
|
7956f2846b | ||
|
|
12a5f2d16a | ||
|
|
817e92ab7a | ||
|
|
f4cd3b95c5 | ||
|
|
a106f89d29 | ||
|
|
322b2fe3a5 | ||
|
|
33520fdee8 |
@@ -35,6 +35,7 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
#include "clientsideencryptionjobs.h"
|
#include "clientsideencryptionjobs.h"
|
||||||
#include "syncresult.h"
|
#include "syncresult.h"
|
||||||
|
#include "vfs_windows.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@@ -1164,6 +1165,10 @@ void AccountSettings::slotDeleteAccount()
|
|||||||
|
|
||||||
// IMPORTANT: "this" is deleted from this point on. We should probably remove this synchronous
|
// IMPORTANT: "this" is deleted from this point on. We should probably remove this synchronous
|
||||||
// .exec() QMessageBox magic above as it recurses into the event loop.
|
// .exec() QMessageBox magic above as it recurses into the event loop.
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
VfsWindows::instance()->unmount();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AccountSettings::event(QEvent *e)
|
bool AccountSettings::event(QEvent *e)
|
||||||
|
|||||||
@@ -263,32 +263,27 @@ Application::~Application()
|
|||||||
|
|
||||||
// Remove the account from the account manager so it can be deleted.
|
// Remove the account from the account manager so it can be deleted.
|
||||||
AccountManager::instance()->shutdown();
|
AccountManager::instance()->shutdown();
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
if(cont)
|
|
||||||
cont->unmount();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
Vfs_windows *_Vfs_windows = NULL;
|
VfsWindows::instance()->unmount();
|
||||||
_Vfs_windows = Vfs_windows::instance();
|
#endif
|
||||||
if (_Vfs_windows) {
|
|
||||||
qDebug() << Q_FUNC_INFO << " Up drive: " << _Vfs_windows;
|
#if defined(Q_OS_MAC)
|
||||||
WCHAR DriveLetter = L'X';
|
VfsMacController::instance()->unmount();
|
||||||
_Vfs_windows->downDrive(DriveLetter);
|
|
||||||
} else
|
|
||||||
qDebug() << Q_FUNC_INFO << " Bad up drive";
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::slotAccountStateRemoved(AccountState *accountState)
|
void Application::slotAccountStateRemoved(AccountState *accountState)
|
||||||
{
|
{
|
||||||
if (_cronDeleteOnlineFiles)
|
/*
|
||||||
|
if (_cronDeleteOnlineFiles)
|
||||||
{
|
{
|
||||||
disconnect(_cronDeleteOnlineFiles, SIGNAL(timeout()), this, SLOT(slotDeleteOnlineFiles()));
|
disconnect(_cronDeleteOnlineFiles, SIGNAL(timeout()), this, SLOT(slotDeleteOnlineFiles()));
|
||||||
_cronDeleteOnlineFiles->stop();
|
_cronDeleteOnlineFiles->stop();
|
||||||
delete _cronDeleteOnlineFiles;
|
delete _cronDeleteOnlineFiles;
|
||||||
_cronDeleteOnlineFiles = NULL;
|
_cronDeleteOnlineFiles = NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (_gui) {
|
if (_gui) {
|
||||||
disconnect(accountState, &AccountState::stateChanged,
|
disconnect(accountState, &AccountState::stateChanged,
|
||||||
@@ -296,21 +291,7 @@ void Application::slotAccountStateRemoved(AccountState *accountState)
|
|||||||
disconnect(accountState->account().data(), &Account::serverVersionChanged,
|
disconnect(accountState->account().data(), &Account::serverVersionChanged,
|
||||||
_gui.data(), &ownCloudGui::slotTrayMessageIfServerUnsupported);
|
_gui.data(), &ownCloudGui::slotTrayMessageIfServerUnsupported);
|
||||||
}
|
}
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
if(cont)
|
|
||||||
cont->unmount();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
Vfs_windows *_Vfs_windows = NULL;
|
|
||||||
_Vfs_windows = Vfs_windows::instance();
|
|
||||||
if (_Vfs_windows) {
|
|
||||||
qDebug() << Q_FUNC_INFO << " Up drive: " << _Vfs_windows;
|
|
||||||
WCHAR DriveLetter = L'X';
|
|
||||||
_Vfs_windows->downDrive(DriveLetter);
|
|
||||||
} else
|
|
||||||
qDebug() << Q_FUNC_INFO << " Bad up drive";
|
|
||||||
#endif
|
|
||||||
if (_folderManager) {
|
if (_folderManager) {
|
||||||
disconnect(accountState, &AccountState::stateChanged,
|
disconnect(accountState, &AccountState::stateChanged,
|
||||||
_folderManager.data(), &FolderMan::slotAccountStateChanged);
|
_folderManager.data(), &FolderMan::slotAccountStateChanged);
|
||||||
@@ -340,53 +321,27 @@ void Application::slotAccountStateAdded(AccountState *accountState)
|
|||||||
_gui->slotTrayMessageIfServerUnsupported(accountState->account().data());
|
_gui->slotTrayMessageIfServerUnsupported(accountState->account().data());
|
||||||
|
|
||||||
// Mount the virtual FileSystem.
|
// Mount the virtual FileSystem.
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
ConfigFile cfgFile;
|
QString rootPath = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/.cachedFiles";
|
||||||
cont = new VfsMacController(cfgFile.defaultFileStreamMirrorPath(), cfgFile.defaultFileStreamSyncPath(), accountState, this);
|
QString mountPath = "/Volumes/" + _theme->appName() + "fs";
|
||||||
#endif
|
VfsMacController::instance()->initialize(rootPath, mountPath, accountState);
|
||||||
|
VfsMacController::instance()->mount();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ConfigFile cfgFile;
|
QString rootPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/cachedFiles/";
|
||||||
QDir pathDir(cfgFile.defaultFileStreamMirrorPath());
|
WCHAR mountLetter = L'X';
|
||||||
while (!pathDir.exists())
|
VfsWindows::instance()->initialize(rootPath, mountLetter, accountState);
|
||||||
{
|
VfsWindows::instance()->mount();
|
||||||
qDebug() << "\n dbg_dokan " << Q_FUNC_INFO << " !pathDir.exists() 3-0" << cfgFile.defaultFileStreamMirrorPath();
|
|
||||||
pathDir.mkdir(cfgFile.defaultFileStreamMirrorPath());
|
|
||||||
SetFileAttributes((const wchar_t *) cfgFile.defaultFileStreamMirrorPath().utf16(), FILE_ATTRIBUTE_HIDDEN);
|
|
||||||
Sleep(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vfs_windows *_Vfs_windows = NULL;
|
|
||||||
_Vfs_windows = new Vfs_windows(accountState);
|
|
||||||
|
|
||||||
if (_Vfs_windows)
|
|
||||||
{
|
|
||||||
qDebug() << "\n dbg_sync " << Q_FUNC_INFO << " Up drive: " << Vfs_windows::instance();
|
|
||||||
_Vfs_windows->upDrive(cfgFile.defaultFileStreamMirrorPath(), cfgFile.defaultFileStreamLetterDrive());
|
|
||||||
Sleep(1000);
|
|
||||||
cfgFile.createAuxiliarDirectories();
|
|
||||||
|
|
||||||
/* Current owncloudgui::slotLogout */
|
|
||||||
//WCHAR DriveLetter = L'X';
|
|
||||||
//connect(this, SIGNAL(aboutToQuit()), _Vfs_windows, SLOT(unmount(DriveLetter)));
|
|
||||||
|
|
||||||
/* Current QuotaInfo::slotUpdateLastQuota */
|
|
||||||
//QuotaInfo _quotaInfo(accountState);
|
|
||||||
//connect(&_quotaInfo, SIGNAL(quotaUpdated(qint64, qint64)), _Vfs_windows, SLOT(quoting(qint64, qint64)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
qDebug() << "\n dbg_sync " << Q_FUNC_INFO << " Bad up drive";
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//< For cron delete dir/files online. Execute each 60000 msec
|
//< For cron delete dir/files online. Execute each 60000 msec
|
||||||
|
|
||||||
//< Uncomment for test "Clean local folder" case.
|
//< Uncomment for test "Clean local folder" case.
|
||||||
/*_cronDeleteOnlineFiles = new QTimer(this);
|
/*_cronDeleteOnlineFiles = new QTimer(this);
|
||||||
connect(_cronDeleteOnlineFiles, SIGNAL(timeout()), this, SLOT(slotDeleteOnlineFiles()));
|
connect(_cronDeleteOnlineFiles, SIGNAL(timeout()), this, SLOT(slotDeleteOnlineFiles()));
|
||||||
_cronDeleteOnlineFiles->start(60000);
|
_cronDeleteOnlineFiles->start(60000);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* See SocketApi::command_SET_DOWNLOAD_MODE
|
/* See SocketApi::command_SET_DOWNLOAD_MODE
|
||||||
//< Dummy example; Not uncomment
|
//< Dummy example; Not uncomment
|
||||||
@@ -843,6 +798,4 @@ void Application::showSettingsDialog()
|
|||||||
_gui->slotShowSettings();
|
_gui->slotShowSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace OCC
|
||||||
} // namespace OCC
|
|
||||||
|
|
||||||
@@ -126,11 +126,18 @@ int FolderMan::unloadAndDeleteAllFolders()
|
|||||||
{
|
{
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
unloadFolder();
|
// clear the list of existing folders.
|
||||||
_folderMap.clear();
|
Folder::MapIterator i(_folderMap);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
Folder *f = i.value();
|
||||||
|
unloadFolder();
|
||||||
|
delete f;
|
||||||
|
cnt++;
|
||||||
|
}
|
||||||
ASSERT(_folderMap.isEmpty());
|
ASSERT(_folderMap.isEmpty());
|
||||||
|
|
||||||
_currentSyncFolder = nullptr;
|
_currentSyncFolder = 0;
|
||||||
_scheduledFolders.clear();
|
_scheduledFolders.clear();
|
||||||
emit folderListChanged(_folderMap);
|
emit folderListChanged(_folderMap);
|
||||||
emit scheduleQueueChanged();
|
emit scheduleQueueChanged();
|
||||||
@@ -658,8 +665,7 @@ void FolderMan::startScheduledSyncSoon()
|
|||||||
if (thread() != QThread::currentThread())
|
if (thread() != QThread::currentThread())
|
||||||
slotStartScheduledFolderSync();
|
slotStartScheduledFolderSync();
|
||||||
else
|
else
|
||||||
_startScheduledSyncTimer.start(msDelay);
|
_startScheduledSyncTimer.start(msDelay);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -730,13 +736,27 @@ void FolderMan::slotEtagPollTimerTimeout()
|
|||||||
|
|
||||||
void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState)
|
void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState)
|
||||||
{
|
{
|
||||||
removeFolder();
|
QVarLengthArray<Folder *, 16> foldersToRemove;
|
||||||
|
Folder::MapIterator i(_folderMap);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
Folder *folder = i.value();
|
||||||
|
if (folder->accountState() == accountState) {
|
||||||
|
foldersToRemove.append(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const auto &f, foldersToRemove) {
|
||||||
|
removeFolder();
|
||||||
|
}
|
||||||
emit folderListChanged(_folderMap);
|
emit folderListChanged(_folderMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::slotForwardFolderSyncStateChange()
|
void FolderMan::slotForwardFolderSyncStateChange()
|
||||||
{
|
{
|
||||||
emit folderSyncStateChange();
|
if (Folder *f = qobject_cast<Folder *>(sender())) {
|
||||||
|
emit folderSyncStateChange();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::slotServerVersionChanged(Account *account)
|
void FolderMan::slotServerVersionChanged(Account *account)
|
||||||
@@ -826,7 +846,7 @@ void FolderMan::slotFolderSyncFinished(const SyncResult &)
|
|||||||
qPrintable(_currentSyncFolder->remoteUrl().toString()));
|
qPrintable(_currentSyncFolder->remoteUrl().toString()));
|
||||||
|
|
||||||
//TODO FUSE
|
//TODO FUSE
|
||||||
//_currentSyncFolder = nullptr;
|
//_currentSyncFolder = 0;
|
||||||
|
|
||||||
startScheduledSyncSoon();
|
startScheduledSyncSoon();
|
||||||
}
|
}
|
||||||
@@ -943,14 +963,15 @@ void FolderMan::removeFolder()
|
|||||||
|
|
||||||
qCInfo(lcFolderMan) << "Removing " << _currentSyncFolder->alias();
|
qCInfo(lcFolderMan) << "Removing " << _currentSyncFolder->alias();
|
||||||
|
|
||||||
const bool currentlyRunning = _currentSyncFolder->isBusy();
|
const bool currentlyRunning = _currentSyncFolder;
|
||||||
if (currentlyRunning) {
|
if (currentlyRunning) {
|
||||||
// abort the sync now
|
// abort the sync now
|
||||||
terminateSyncProcess();
|
terminateSyncProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
_scheduledFolders.clear();
|
if (_scheduledFolders.removeAll(_currentSyncFolder)>0){
|
||||||
emit scheduleQueueChanged();
|
emit scheduleQueueChanged();
|
||||||
|
}
|
||||||
|
|
||||||
_currentSyncFolder->wipe();
|
_currentSyncFolder->wipe();
|
||||||
_currentSyncFolder->setSyncPaused(true);
|
_currentSyncFolder->setSyncPaused(true);
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ void GeneralSettings::slotToggleOptionalServerNotifications(bool enable)
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//< Set configuration paths.
|
//< Set configuration paths.
|
||||||
|
|
||||||
QString m_defaultFileStreamSyncPath = cfgFile.defaultFileStreamSyncPath();
|
QString m_defaultFileStreamSyncPath = cfgFile.defaultFileStreamSyncPath();
|
||||||
QString m_defaultFileStreamMirrorPath = cfgFile.defaultFileStreamMirrorPath();
|
QString m_defaultFileStreamMirrorPath = cfgFile.defaultFileStreamMirrorPath();
|
||||||
QString m_defaultFileStreamLetterDrive = cfgFile.defaultFileStreamLetterDrive();
|
QString m_defaultFileStreamLetterDrive = cfgFile.defaultFileStreamLetterDrive();
|
||||||
|
|||||||
@@ -1007,22 +1007,13 @@ void ownCloudGui::slotLogout()
|
|||||||
ai->signOutByUi();
|
ai->signOutByUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#if defined(Q_OS_WIN)
|
||||||
* JP 09/2018.
|
VfsWindows::instance()->unmount();
|
||||||
* Down Virtual File System.
|
#endif
|
||||||
*/
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_MAC)
|
||||||
Vfs_windows *_Vfs_windows = NULL;
|
VfsMacController::instance()->unmount();
|
||||||
_Vfs_windows = Vfs_windows::instance();
|
#endif
|
||||||
if (_Vfs_windows)
|
|
||||||
{
|
|
||||||
qDebug() << "\n dbg_sync " << Q_FUNC_INFO << "up Drive: " << _Vfs_windows;
|
|
||||||
WCHAR DriveLetter = L'X';
|
|
||||||
_Vfs_windows->downDrive(DriveLetter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
qDebug() << "\n dbg_sync " << Q_FUNC_INFO << " BAD up Drive";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ownCloudGui::slotUnpauseAllFolders()
|
void ownCloudGui::slotUnpauseAllFolders()
|
||||||
|
|||||||
@@ -336,6 +336,10 @@ void OwncloudSetupWizard::slotConnectToOCUrl(const QString &url)
|
|||||||
.arg(url));
|
.arg(url));
|
||||||
|
|
||||||
testOwnCloudConnect();
|
testOwnCloudConnect();
|
||||||
|
|
||||||
|
emit _ocWizard->basicSetupFinished(1);
|
||||||
|
_ocWizard->close();
|
||||||
|
emit ownCloudWizardDone(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OwncloudSetupWizard::testOwnCloudConnect()
|
void OwncloudSetupWizard::testOwnCloudConnect()
|
||||||
|
|||||||
@@ -120,13 +120,8 @@ void QuotaInfo::slotUpdateLastQuota(const QVariantMap &result)
|
|||||||
_lastQuotaTotalBytes = avail >= 0 ? _lastQuotaUsedBytes + avail : avail;
|
_lastQuotaTotalBytes = avail >= 0 ? _lastQuotaUsedBytes + avail : avail;
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
Vfs_windows *m_Vfs_windows = NULL;
|
VfsWindows::instance()->setNumberOfBytes((unsigned long long)_lastQuotaTotalBytes);
|
||||||
m_Vfs_windows = Vfs_windows::instance();
|
VfsWindows::instance()->setNumberOfFreeBytes((unsigned long long)_lastQuotaUsedBytes);
|
||||||
if (m_Vfs_windows)
|
|
||||||
{
|
|
||||||
m_Vfs_windows->DsetTotalNumberOfBytes((unsigned long long)_lastQuotaTotalBytes);
|
|
||||||
m_Vfs_windows->DsetTotalNumberOfFreeBytes((unsigned long long)_lastQuotaUsedBytes);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
emit quotaUpdated(_lastQuotaTotalBytes, _lastQuotaUsedBytes);
|
emit quotaUpdated(_lastQuotaTotalBytes, _lastQuotaUsedBytes);
|
||||||
|
|||||||
@@ -343,16 +343,16 @@ void SocketApi::slotUnregisterPath(const QString &alias)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Folder *f = FolderMan::instance()->folder(alias);
|
Folder *f = FolderMan::instance()->folder(alias);
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ConfigFile Cfg;
|
ConfigFile Cfg;
|
||||||
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append(":/");
|
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append(":/");
|
||||||
broadcastMessage(buildMessage(QLatin1String("UNREGISTER_PATH"), FileStreamLetterDrive, QString()), true);
|
broadcastMessage(buildMessage(QLatin1String("UNREGISTER_PATH"), FileStreamLetterDrive, QString()), true);
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
broadcastMessage(buildMessage(QLatin1String("UNREGISTER_PATH"), removeTrailingSlash(f->path()), QString()), true);
|
broadcastMessage(buildMessage(QLatin1String("UNREGISTER_PATH"), removeTrailingSlash(f->path()), QString()), true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
_registeredAliases.remove(alias);
|
_registeredAliases.remove(alias);
|
||||||
}
|
}
|
||||||
@@ -375,13 +375,13 @@ void SocketApi::slotUpdateFolderView()
|
|||||||
QString rootPath = removeTrailingSlash(f->path());
|
QString rootPath = removeTrailingSlash(f->path());
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ConfigFile Cfg;
|
ConfigFile Cfg;
|
||||||
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append(":");
|
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append(":");
|
||||||
broadcastStatusPushMessage(FileStreamLetterDrive, f->syncEngine().syncFileStatusTracker().fileStatus(""));
|
broadcastStatusPushMessage(FileStreamLetterDrive, f->syncEngine().syncFileStatusTracker().fileStatus(""));
|
||||||
broadcastMessage(buildMessage(QLatin1String("UPDATE_VIEW"), FileStreamLetterDrive.append("/")));
|
broadcastMessage(buildMessage(QLatin1String("UPDATE_VIEW"), FileStreamLetterDrive.append("/")));
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
broadcastStatusPushMessage(rootPath, f->syncEngine().syncFileStatusTracker().fileStatus(""));
|
broadcastStatusPushMessage(rootPath, f->syncEngine().syncFileStatusTracker().fileStatus(""));
|
||||||
broadcastMessage(buildMessage(QLatin1String("UPDATE_VIEW"), rootPath));
|
broadcastMessage(buildMessage(QLatin1String("UPDATE_VIEW"), rootPath));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
qCDebug(lcSocketApi) << "Not sending UPDATE_VIEW for" << f->alias() << "because status() is" << f->syncResult().status();
|
qCDebug(lcSocketApi) << "Not sending UPDATE_VIEW for" << f->alias() << "because status() is" << f->syncResult().status();
|
||||||
@@ -454,8 +454,8 @@ void SocketApi::broadcastStatusPushMessage(const QString &systemPath, SyncFileSt
|
|||||||
QString msg = buildMessage(QLatin1String("STATUS"), systemPath, fileStatus.toSocketAPIString());
|
QString msg = buildMessage(QLatin1String("STATUS"), systemPath, fileStatus.toSocketAPIString());
|
||||||
Q_ASSERT(!systemPath.endsWith('/'));
|
Q_ASSERT(!systemPath.endsWith('/'));
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ConfigFile Cfg;
|
ConfigFile Cfg;
|
||||||
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append("://");
|
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append("://");
|
||||||
uint directoryHash = qHash(systemPath.left(FileStreamLetterDrive.lastIndexOf('/')));
|
uint directoryHash = qHash(systemPath.left(FileStreamLetterDrive.lastIndexOf('/')));
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
uint directoryHash = qHash(systemPath.left(systemPath.lastIndexOf('/')));
|
uint directoryHash = qHash(systemPath.left(systemPath.lastIndexOf('/')));
|
||||||
@@ -466,9 +466,9 @@ void SocketApi::broadcastStatusPushMessage(const QString &systemPath, SyncFileSt
|
|||||||
QString systemPath2 = systemPath;
|
QString systemPath2 = systemPath;
|
||||||
systemPath2.replace(0, relative_prefix.length(), Cfg.defaultFileStreamLetterDrive().toUpper().append(":"));
|
systemPath2.replace(0, relative_prefix.length(), Cfg.defaultFileStreamLetterDrive().toUpper().append(":"));
|
||||||
QString msg2 = buildMessage(QLatin1String("STATUS"), systemPath2, fileStatus.toSocketAPIString());
|
QString msg2 = buildMessage(QLatin1String("STATUS"), systemPath2, fileStatus.toSocketAPIString());
|
||||||
listener.sendMessageIfDirectoryMonitored(msg2, directoryHash);
|
listener.sendMessageIfDirectoryMonitored(msg2, directoryHash);
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
listener.sendMessageIfDirectoryMonitored(msg, directoryHash);
|
listener.sendMessageIfDirectoryMonitored(msg, directoryHash);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -481,11 +481,11 @@ void SocketApi::command_RETRIEVE_FOLDER_STATUS(const QString &argument, SocketLi
|
|||||||
|
|
||||||
void SocketApi::command_RETRIEVE_FILE_STATUS(const QString &argumentC, SocketListener *listener)
|
void SocketApi::command_RETRIEVE_FILE_STATUS(const QString &argumentC, SocketListener *listener)
|
||||||
{
|
{
|
||||||
QString argument = argumentC;
|
QString argument = argumentC;
|
||||||
QString relative_prefix = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/cachedFiles/";
|
QString relative_prefix = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/cachedFiles/";
|
||||||
argument.replace(0, 3, relative_prefix);
|
argument.replace(0, 3, relative_prefix);
|
||||||
|
|
||||||
QString statusString;
|
QString statusString;
|
||||||
|
|
||||||
auto fileData = FileData::get(argument);
|
auto fileData = FileData::get(argument);
|
||||||
if (!fileData.folder) {
|
if (!fileData.folder) {
|
||||||
@@ -501,19 +501,19 @@ void SocketApi::command_RETRIEVE_FILE_STATUS(const QString &argumentC, SocketLis
|
|||||||
// Let the listener know that it should now send status pushes for sibblings of this file.
|
// Let the listener know that it should now send status pushes for sibblings of this file.
|
||||||
QString directory = fileData.localPath.left(fileData.localPath.lastIndexOf('/'));
|
QString directory = fileData.localPath.left(fileData.localPath.lastIndexOf('/'));
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ConfigFile Cfg;
|
ConfigFile Cfg;
|
||||||
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append("://");
|
QString FileStreamLetterDrive = Cfg.defaultFileStreamLetterDrive().toUpper().append("://");
|
||||||
listener->registerMonitoredDirectory(qHash(FileStreamLetterDrive));
|
listener->registerMonitoredDirectory(qHash(FileStreamLetterDrive));
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
listener->registerMonitoredDirectory(qHash(directory));
|
listener->registerMonitoredDirectory(qHash(directory));
|
||||||
#endif
|
#endif
|
||||||
SyncFileStatus fileStatus = fileData.syncFileStatus();
|
SyncFileStatus fileStatus = fileData.syncFileStatus();
|
||||||
statusString = fileStatus.toSocketAPIString();
|
statusString = fileStatus.toSocketAPIString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//QString message2 = message;
|
//QString message2 = message;
|
||||||
//QString relative_prefix = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/cachedFiles/";
|
//QString relative_prefix = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/cachedFiles/";
|
||||||
argument.replace(0, relative_prefix.length(), QString("X:\\"));
|
argument.replace(0, relative_prefix.length(), QString("X:\\"));
|
||||||
|
|
||||||
const QString message = QLatin1String("STATUS:") % statusString % QLatin1Char(':') % QDir::toNativeSeparators(argument);
|
const QString message = QLatin1String("STATUS:") % statusString % QLatin1Char(':') % QDir::toNativeSeparators(argument);
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ void SocketApi::command_RETRIEVE_FILE_STATUS(const QString &argumentC, SocketLis
|
|||||||
void SocketApi::command_SHARE(const QString &localFileC, SocketListener *listener)
|
void SocketApi::command_SHARE(const QString &localFileC, SocketListener *listener)
|
||||||
{
|
{
|
||||||
QString localFile = localFileC;
|
QString localFile = localFileC;
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
OCC::ConfigFile Cfg;
|
OCC::ConfigFile Cfg;
|
||||||
char letter[2];
|
char letter[2];
|
||||||
@@ -954,8 +954,8 @@ void SocketApi::sendSharingContextMenuOptions(const FileData &fileData, SocketLi
|
|||||||
// If sharing is globally disabled, do not show any sharing entries.
|
// If sharing is globally disabled, do not show any sharing entries.
|
||||||
// If there is no permission to share for this file, add a disabled entry saying so
|
// If there is no permission to share for this file, add a disabled entry saying so
|
||||||
|
|
||||||
listener->sendMessage(QLatin1String("MENU_ITEM:OFFLINE_DOWNLOAD_MODE") + flagString + tr("0ff line"));
|
listener->sendMessage(QLatin1String("MENU_ITEM:OFFLINE_DOWNLOAD_MODE") + flagString + tr("0ffline"));
|
||||||
listener->sendMessage(QLatin1String("MENU_ITEM:ONLINE_DOWNLOAD_MODE") + flagString + tr("On line"));
|
listener->sendMessage(QLatin1String("MENU_ITEM:ONLINE_DOWNLOAD_MODE") + flagString + tr("Online"));
|
||||||
|
|
||||||
if (isOnTheServer && !record._remotePerm.isNull() && !record._remotePerm.hasPermission(RemotePermissions::CanReshare)) {
|
if (isOnTheServer && !record._remotePerm.isNull() && !record._remotePerm.hasPermission(RemotePermissions::CanReshare)) {
|
||||||
listener->sendMessage(QLatin1String("MENU_ITEM:DISABLED:d:") + tr("Resharing this file is not allowed"));
|
listener->sendMessage(QLatin1String("MENU_ITEM:DISABLED:d:") + tr("Resharing this file is not allowed"));
|
||||||
@@ -1064,10 +1064,10 @@ void SocketApi::command_GET_MENU_ITEMS(const QString &argumentC, OCC::SocketList
|
|||||||
QString SocketApi::buildRegisterPathMessage(const QString &pathC)
|
QString SocketApi::buildRegisterPathMessage(const QString &pathC)
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ConfigFile Cfg;
|
ConfigFile Cfg;
|
||||||
QString path = Cfg.defaultFileStreamLetterDrive().toUpper().append(":/");
|
QString path = Cfg.defaultFileStreamLetterDrive().toUpper().append(":/");
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
QString path = pathC;
|
QString path = pathC;
|
||||||
#endif
|
#endif
|
||||||
QFileInfo fi(path);
|
QFileInfo fi(path);
|
||||||
QString message = QLatin1String("REGISTER_PATH:");
|
QString message = QLatin1String("REGISTER_PATH:");
|
||||||
@@ -1099,7 +1099,7 @@ void SocketApi::command_ONLINE_DOWNLOAD_MODE(const QString &path, SocketListener
|
|||||||
QString relative_prefix = cfg.defaultFileStreamMirrorPath();
|
QString relative_prefix = cfg.defaultFileStreamMirrorPath();
|
||||||
QString relative_path = path;
|
QString relative_path = path;
|
||||||
relative_path = relative_path.replace(0, relative_prefix.length(), QString(""));
|
relative_path = relative_path.replace(0, relative_prefix.length(), QString(""));
|
||||||
|
|
||||||
qDebug() << "\n" << Q_FUNC_INFO << "ONLINE_DOWNLOAD_MODE: " << relative_path;
|
qDebug() << "\n" << Q_FUNC_INFO << "ONLINE_DOWNLOAD_MODE: " << relative_path;
|
||||||
SyncJournalDb::instance()->setSyncMode(relative_path, SyncJournalDb::SYNCMODE_ONLINE);
|
SyncJournalDb::instance()->setSyncMode(relative_path, SyncJournalDb::SYNCMODE_ONLINE);
|
||||||
//< Example
|
//< Example
|
||||||
@@ -1230,9 +1230,8 @@ void SocketApi::command_GET_DOWNLOAD_MODE(const QString &localFileC, SocketListe
|
|||||||
localFile.replace(0, 3, QString(""));
|
localFile.replace(0, 3, QString(""));
|
||||||
localFile.replace("\\", "/");
|
localFile.replace("\\", "/");
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
ConfigFile cfg;
|
QString relative_prefix = cfgFile.getFsMirrorPath();
|
||||||
QString relative_prefix = cfg.defaultFileStreamMirrorPath();
|
localFile = localFile.replace(0, relative_prefix.length(), QString(""));
|
||||||
localFile = localFile.replace(0, relative_prefix.length(), QString(""));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qDebug() << Q_FUNC_INFO << " localFile_0: " << localFile;
|
qDebug() << Q_FUNC_INFO << " localFile_0: " << localFile;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -25,29 +25,40 @@
|
|||||||
|
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QWaitCondition>
|
#include <QWaitCondition>
|
||||||
|
#include <QRunnable>
|
||||||
|
#include <QThreadPool>
|
||||||
|
#include <QStorageInfo>
|
||||||
#include "syncwrapper.h"
|
#include "syncwrapper.h"
|
||||||
|
|
||||||
namespace OCC {
|
namespace OCC {
|
||||||
|
|
||||||
class Vfs_windows : public QObject
|
class CleanIgnoredTask : public QObject, public QRunnable
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
class VfsWindows : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static Vfs_windows* instance();
|
~VfsWindows();
|
||||||
|
static VfsWindows *instance();
|
||||||
|
void initialize(QString rootPath, WCHAR mountLetter, AccountState *accountState);
|
||||||
|
void mount();
|
||||||
|
void unmount();
|
||||||
|
bool removeRecursively(const QString &dirName);
|
||||||
|
bool removeDir();
|
||||||
|
|
||||||
Vfs_windows(AccountState *);
|
void setNumberOfBytes(unsigned long long numberOfBytes);
|
||||||
~Vfs_windows();
|
unsigned long long getNumberOfBytes();
|
||||||
void upDrive(QString, QString);
|
|
||||||
void downDrive(WCHAR DriveLetter);
|
|
||||||
bool removeDir(const QString &);
|
|
||||||
|
|
||||||
void DsetTotalNumberOfBytes(unsigned long long n);
|
void setNumberOfFreeBytes(unsigned long long numberOfFreeBytes);
|
||||||
unsigned long long DgetTotalNumberOfBytes();
|
unsigned long long getNumberOfFreeBytes();
|
||||||
|
|
||||||
void DsetTotalNumberOfFreeBytes(unsigned long long n);
|
|
||||||
unsigned long long DgetTotalNumberOfFreeBytes();
|
|
||||||
|
|
||||||
QStringList* contentsOfDirectoryAtPath(QString path, QVariantMap &error);
|
QStringList* contentsOfDirectoryAtPath(QString path, QVariantMap &error);
|
||||||
|
QList<QString> ignoredList;
|
||||||
|
|
||||||
void createFileAtPath(QString path, QVariantMap &error);
|
void createFileAtPath(QString path, QVariantMap &error);
|
||||||
void moveFileAtPath(QString path, QString npath,QVariantMap &error);
|
void moveFileAtPath(QString path, QString npath,QVariantMap &error);
|
||||||
@@ -61,10 +72,23 @@ public:
|
|||||||
void endDeleteDirectoryAtPath(QString path, QVariantMap &error);
|
void endDeleteDirectoryAtPath(QString path, QVariantMap &error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Vfs_windows *_instance;
|
VfsWindows();
|
||||||
QMap<QString, OCC::DiscoveryDirectoryResult*> _fileListMap;
|
QList<QString> getLogicalDrives();
|
||||||
QPointer<OCC::DiscoveryFolderFileList> _remotefileListJob;
|
static VfsWindows *_instance;
|
||||||
QString rootPath_;
|
QMap<QString, OCC::DiscoveryDirectoryResult *> _fileListMap;
|
||||||
|
QPointer<OCC::DiscoveryFolderFileList> _remotefileListJob;
|
||||||
|
QString rootPath;
|
||||||
|
WCHAR mountLetter;
|
||||||
|
|
||||||
|
// @Capacity
|
||||||
|
//*TotalNumberOfBytes = (ULONGLONG)1024L * 1024 * 1024 * 50;
|
||||||
|
unsigned long long numberOfBytes = 0;
|
||||||
|
// @Used space
|
||||||
|
//*TotalNumberOfFreeBytes = (ULONGLONG)1024L * 1024 * 10;
|
||||||
|
unsigned long long numberOfFreeBytes = 0;
|
||||||
|
// @Free space
|
||||||
|
//*FreeBytesAvailable = (ULONGLONG)(*TotalNumberOfBytes - *TotalNumberOfFreeBytes); / *1024 * 1024 * 10;
|
||||||
|
unsigned long long freeBytesAvailable = 0;
|
||||||
|
|
||||||
// To sync
|
// To sync
|
||||||
OCC::SyncWrapper *_syncWrapper;
|
OCC::SyncWrapper *_syncWrapper;
|
||||||
@@ -92,5 +116,4 @@ public slots:
|
|||||||
|
|
||||||
} // namespace OCC
|
} // namespace OCC
|
||||||
|
|
||||||
#endif // VFS_WINDOWS_H
|
#endif // VFS_WINDOWS_H
|
||||||
|
|
||||||
Reference in New Issue
Block a user