1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2026-04-11 02:57:42 +02:00

Compare commits

...

11 Commits

Author SHA1 Message Date
Camila San
b1667f48d3 Fix context menu wording.
Signed-off-by: Camila San <hello@camila.codes>
2019-09-13 23:50:49 +02:00
Bani Azarael
33f9ae827f Revert to "Refactor for hardcoded strings"
2be6d1a4fe645df34f369bf467ecdd201daeccf9
2019-09-13 23:48:19 +02:00
Bani Azarael
ef4541f834 Refactor for hardcoded strings 2019-09-13 23:33:08 +02:00
Bani Azarael
1b6a9bf128 Get logical drives available on Windows 2019-09-13 23:18:36 +02:00
Bani Azarael
7956f2846b Fix duplicate files
Add an ignored list for not creation
2019-09-13 23:18:00 +02:00
Bani Azarael
12a5f2d16a Change VolName on Windows 2019-09-13 23:17:26 +02:00
Bani Azarael
817e92ab7a Unmount when removing account 2019-09-13 22:45:03 +02:00
Bani Azarael
f4cd3b95c5 Fix logout on Windows 2019-09-13 22:41:33 +02:00
Bani Azarael
a106f89d29 Improvements for VfsWindows 2019-09-13 22:35:49 +02:00
Bani Azarael
322b2fe3a5 Indent lines | Remove unused variables and qDebug 2019-09-13 21:52:22 +02:00
Bani Azarael
33520fdee8 Add changes to moveFileAtPath on Windows 2019-09-13 21:51:49 +02:00
10 changed files with 2380 additions and 2487 deletions

View File

@@ -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)

View File

@@ -263,25 +263,19 @@ 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()));
@@ -289,6 +283,7 @@ void Application::slotAccountStateRemoved(AccountState *accountState)
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);
@@ -341,42 +322,17 @@ void Application::slotAccountStateAdded(AccountState *accountState)
// 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";
VfsMacController::instance()->initialize(rootPath, mountPath, accountState);
VfsMacController::instance()->mount();
#endif #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
@@ -387,7 +343,6 @@ void Application::slotAccountStateAdded(AccountState *accountState)
_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
SyncJournalDb::instance()->setSyncMode(QString("C:/Users/poncianoj/zd"), SyncJournalDb::SYNCMODE_OFFLINE); SyncJournalDb::instance()->setSyncMode(QString("C:/Users/poncianoj/zd"), SyncJournalDb::SYNCMODE_OFFLINE);
@@ -843,6 +798,4 @@ void Application::showSettingsDialog()
_gui->slotShowSettings(); _gui->slotShowSettings();
} }
} // namespace OCC } // namespace OCC

View File

@@ -126,11 +126,18 @@ int FolderMan::unloadAndDeleteAllFolders()
{ {
int cnt = 0; int cnt = 0;
// clear the list of existing folders.
Folder::MapIterator i(_folderMap);
while (i.hasNext()) {
i.next();
Folder *f = i.value();
unloadFolder(); unloadFolder();
_folderMap.clear(); 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();
@@ -659,7 +666,6 @@ void FolderMan::startScheduledSyncSoon()
slotStartScheduledFolderSync(); slotStartScheduledFolderSync();
else else
_startScheduledSyncTimer.start(msDelay); _startScheduledSyncTimer.start(msDelay);
} }
/* /*
@@ -730,14 +736,28 @@ void FolderMan::slotEtagPollTimerTimeout()
void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState) void FolderMan::slotRemoveFoldersForAccount(AccountState *accountState)
{ {
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(); removeFolder();
}
emit folderListChanged(_folderMap); emit folderListChanged(_folderMap);
} }
void FolderMan::slotForwardFolderSyncStateChange() void FolderMan::slotForwardFolderSyncStateChange()
{ {
if (Folder *f = qobject_cast<Folder *>(sender())) {
emit folderSyncStateChange(); 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);

View File

@@ -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();

View File

@@ -1007,21 +1007,12 @@ void ownCloudGui::slotLogout()
ai->signOutByUi(); ai->signOutByUi();
} }
/*
* JP 09/2018.
* Down Virtual File System.
*/
#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)
{ #if defined(Q_OS_MAC)
qDebug() << "\n dbg_sync " << Q_FUNC_INFO << "up Drive: " << _Vfs_windows; VfsMacController::instance()->unmount();
WCHAR DriveLetter = L'X';
_Vfs_windows->downDrive(DriveLetter);
}
else
qDebug() << "\n dbg_sync " << Q_FUNC_INFO << " BAD up Drive";
#endif #endif
} }

View File

@@ -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()

View File

@@ -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);

View File

@@ -1230,8 +1230,7 @@ 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

File diff suppressed because it is too large Load Diff

View File

@@ -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 Q_OBJECT
public: public:
static Vfs_windows* instance(); void run();
};
Vfs_windows(AccountState *); class VfsWindows : public QObject
~Vfs_windows(); {
void upDrive(QString, QString); Q_OBJECT
void downDrive(WCHAR DriveLetter); public:
bool removeDir(const QString &); ~VfsWindows();
static VfsWindows *instance();
void initialize(QString rootPath, WCHAR mountLetter, AccountState *accountState);
void mount();
void unmount();
bool removeRecursively(const QString &dirName);
bool removeDir();
void DsetTotalNumberOfBytes(unsigned long long n); void setNumberOfBytes(unsigned long long numberOfBytes);
unsigned long long DgetTotalNumberOfBytes(); unsigned long long getNumberOfBytes();
void DsetTotalNumberOfFreeBytes(unsigned long long n); void setNumberOfFreeBytes(unsigned long long numberOfFreeBytes);
unsigned long long DgetTotalNumberOfFreeBytes(); unsigned long long getNumberOfFreeBytes();
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();
QList<QString> getLogicalDrives();
static VfsWindows *_instance;
QMap<QString, OCC::DiscoveryDirectoryResult *> _fileListMap; QMap<QString, OCC::DiscoveryDirectoryResult *> _fileListMap;
QPointer<OCC::DiscoveryFolderFileList> _remotefileListJob; QPointer<OCC::DiscoveryFolderFileList> _remotefileListJob;
QString rootPath_; 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;
@@ -93,4 +117,3 @@ public slots:
} // namespace OCC } // namespace OCC
#endif // VFS_WINDOWS_H #endif // VFS_WINDOWS_H