Comparar commits
6 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| e95b73dfac | |||
| c00e3e8c0a | |||
| 2a12610a46 | |||
| d466a05915 | |||
| e05d6bfcdc | |||
| b49dd02e3d |
@@ -89,7 +89,7 @@ struct csync_s {
|
||||
|
||||
/* hooks for checking the white list (uses the update_callback_userdata) */
|
||||
int (*checkSelectiveSyncBlackListHook)(void*, const char*);
|
||||
int (*checkSelectiveSyncNewFolderHook)(void*, const char* /* path */, const char* /* remotePerm */);
|
||||
int (*checkSelectiveSyncNewFolderHook)(void*, const char*);
|
||||
|
||||
|
||||
csync_vio_opendir_hook remote_opendir_hook;
|
||||
|
||||
@@ -436,7 +436,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
|
||||
st->instruction = CSYNC_INSTRUCTION_NEW;
|
||||
|
||||
if (fs->type == CSYNC_VIO_FILE_TYPE_DIRECTORY && ctx->current == REMOTE_REPLICA && ctx->callbacks.checkSelectiveSyncNewFolderHook) {
|
||||
if (ctx->callbacks.checkSelectiveSyncNewFolderHook(ctx->callbacks.update_callback_userdata, path, fs->remotePerm)) {
|
||||
if (ctx->callbacks.checkSelectiveSyncNewFolderHook(ctx->callbacks.update_callback_userdata, path)) {
|
||||
csync_file_stat_free(st);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -675,13 +675,8 @@ void AccountSettings::refreshSelectiveSyncStatus()
|
||||
ui->selectiveSyncButtons->setVisible(true);
|
||||
ui->bigFolderUi->setVisible(false);
|
||||
} else {
|
||||
ConfigFile cfg;
|
||||
QString info =
|
||||
!cfg.confirmExternalStorage() ? tr("There are folders that were not synchronized because they are too big: ") :
|
||||
!cfg.newBigFolderSizeLimit().first ? tr("There are folders that were not synchronized because they are external storages: ") :
|
||||
tr("There are folders that were not synchronized because they are too big or external storages: ");
|
||||
|
||||
ui->selectiveSyncNotification->setText(info + msg);
|
||||
QString wholeMsg = tr("There are new folders that were not synchronized because they are too big: ") + msg;
|
||||
ui->selectiveSyncNotification->setText(wholeMsg);
|
||||
ui->selectiveSyncButtons->setVisible(false);
|
||||
ui->bigFolderUi->setVisible(true);
|
||||
shouldBeVisible = true;
|
||||
|
||||
+7
-12
@@ -104,8 +104,7 @@ Folder::Folder(const FolderDefinition& definition,
|
||||
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(newBigFolder(QString,bool)),
|
||||
this, SLOT(slotNewBigFolderDiscovered(QString,bool)));
|
||||
connect(_engine.data(), SIGNAL(newBigFolder(QString)), this, SLOT(slotNewBigFolderDiscovered(QString)));
|
||||
connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString)));
|
||||
connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)),
|
||||
SLOT(slotLogPropagationStart()));
|
||||
@@ -749,12 +748,10 @@ void Folder::startSync(const QStringList &pathList)
|
||||
|
||||
setDirtyNetworkLimits();
|
||||
|
||||
SyncOptions opt;
|
||||
ConfigFile cfgFile;
|
||||
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
|
||||
opt._newBigFolderSizeLimit = newFolderLimit.first ? newFolderLimit.second * 1000LL * 1000LL : -1; // convert from MB to B
|
||||
opt._confirmExternalStorage = cfgFile.confirmExternalStorage();
|
||||
_engine->setSyncOptions(opt);
|
||||
quint64 limit = newFolderLimit.first ? newFolderLimit.second * 1000 * 1000 : -1; // convert from MB to B
|
||||
_engine->setNewBigFolderSizeLimit(limit);
|
||||
|
||||
_engine->setIgnoreHiddenFiles(_definition.ignoreHiddenFiles);
|
||||
|
||||
@@ -931,7 +928,7 @@ void Folder::slotItemCompleted(const SyncFileItem &item, const PropagatorJob& jo
|
||||
emit ProgressDispatcher::instance()->itemCompleted(alias(), item, job);
|
||||
}
|
||||
|
||||
void Folder::slotNewBigFolderDiscovered(const QString &newF, bool isExternal)
|
||||
void Folder::slotNewBigFolderDiscovered(const QString &newF)
|
||||
{
|
||||
auto newFolder = newF;
|
||||
if (!newFolder.endsWith(QLatin1Char('/'))) {
|
||||
@@ -956,11 +953,9 @@ void Folder::slotNewBigFolderDiscovered(const QString &newF, bool isExternal)
|
||||
journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList);
|
||||
emit newBigFolderDiscovered(newFolder);
|
||||
}
|
||||
QString message = !isExternal ?
|
||||
(tr("A new folder larger than %1 MB has been added: %2.\n")
|
||||
.arg(ConfigFile().newBigFolderSizeLimit().second).arg(newF))
|
||||
: (tr("A folder from an external storage has been added.\n"));
|
||||
message += tr("Please go in the settings to select it if you wish to download it.");
|
||||
QString message = tr("A new folder larger than %1 MB has been added: %2.\n"
|
||||
"Please go in the settings to select it if you wish to download it.")
|
||||
.arg(ConfigFile().newBigFolderSizeLimit().second).arg(newF);
|
||||
|
||||
auto logger = Logger::instance();
|
||||
logger->postOptionalGuiLog(Theme::instance()->appNameGUI(), message);
|
||||
|
||||
+1
-1
@@ -290,7 +290,7 @@ private slots:
|
||||
|
||||
void slotEmitFinishedDelayed();
|
||||
|
||||
void slotNewBigFolderDiscovered(const QString &, bool isExternal);
|
||||
void slotNewBigFolderDiscovered(const QString &);
|
||||
|
||||
void slotLogPropagationStart();
|
||||
|
||||
|
||||
@@ -29,14 +29,6 @@ Q_DECLARE_METATYPE(QPersistentModelIndex)
|
||||
namespace OCC {
|
||||
|
||||
static const char propertyParentIndexC[] = "oc_parentIndex";
|
||||
static const char propertyPermissionMap[] = "oc_permissionMap";
|
||||
|
||||
static QString removeTrailingSlash(const QString &s) {
|
||||
if (s.endsWith('/')) {
|
||||
return s.left(s.size() - 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
FolderStatusModel::FolderStatusModel(QObject *parent)
|
||||
:QAbstractItemModel(parent), _accountState(0), _dirty(false)
|
||||
@@ -170,7 +162,7 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::CheckStateRole:
|
||||
return x._checked;
|
||||
case Qt::DecorationRole:
|
||||
return QFileIconProvider().icon(x._isExternal ? QFileIconProvider::Network : QFileIconProvider::Folder);
|
||||
return QFileIconProvider().icon(QFileIconProvider::Folder);
|
||||
case Qt::ForegroundRole:
|
||||
if (x._isUndecided) {
|
||||
return QColor(Qt::red);
|
||||
@@ -376,9 +368,6 @@ FolderStatusModel::SubFolderInfo* FolderStatusModel::infoForIndex(const QModelIn
|
||||
if (parentInfo->hasLabel()) {
|
||||
return 0;
|
||||
}
|
||||
if (index.row() >= parentInfo->_subs.size()) {
|
||||
return 0;
|
||||
}
|
||||
return &parentInfo->_subs[index.row()];
|
||||
} else {
|
||||
if (index.row() >= _folders.count()) {
|
||||
@@ -548,15 +537,12 @@ void FolderStatusModel::fetchMore(const QModelIndex& parent)
|
||||
path += info->_path;
|
||||
}
|
||||
LsColJob *job = new LsColJob(_accountState->account(), path, this);
|
||||
job->setProperties(QList<QByteArray>() << "resourcetype" << "http://owncloud.org/ns:size" << "http://owncloud.org/ns:permissions");
|
||||
job->setProperties(QList<QByteArray>() << "resourcetype" << "http://owncloud.org/ns:size");
|
||||
job->setTimeout(60 * 1000);
|
||||
connect(job, SIGNAL(directoryListingSubfolders(QStringList)),
|
||||
SLOT(slotUpdateDirectories(QStringList)));
|
||||
connect(job, SIGNAL(finishedWithError(QNetworkReply*)),
|
||||
this, SLOT(slotLscolFinishedWithError(QNetworkReply*)));
|
||||
connect(job, SIGNAL(directoryListingIterated(const QString&, const QMap<QString,QString>&)),
|
||||
this, SLOT(slotGatherPermissions(const QString&, const QMap<QString,QString>&)));
|
||||
|
||||
job->start();
|
||||
|
||||
QPersistentModelIndex persistentIndex(parent);
|
||||
@@ -567,20 +553,6 @@ void FolderStatusModel::fetchMore(const QModelIndex& parent)
|
||||
QTimer::singleShot(1000, this, SLOT(slotShowFetchProgress()));
|
||||
}
|
||||
|
||||
void FolderStatusModel::slotGatherPermissions(const QString &href, const QMap<QString,QString> &map)
|
||||
{
|
||||
auto it = map.find("permissions");
|
||||
if (it == map.end())
|
||||
return;
|
||||
|
||||
auto job = sender();
|
||||
auto permissionMap = job->property(propertyPermissionMap).toMap();
|
||||
job->setProperty(propertyPermissionMap, QVariant()); // avoid a detach of the map while it is modified
|
||||
Q_ASSERT(!href.endsWith(QLatin1Char('/'))); // LsColXMLParser::parse removes the trailing slash before calling us.
|
||||
permissionMap[href] = *it;
|
||||
job->setProperty(propertyPermissionMap, permissionMap);
|
||||
}
|
||||
|
||||
void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
||||
{
|
||||
auto job = qobject_cast<LsColJob *>(sender());
|
||||
@@ -626,7 +598,6 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
||||
selectiveSyncUndecidedSet.insert(str);
|
||||
}
|
||||
}
|
||||
const auto permissionMap = job->property(propertyPermissionMap).toMap();
|
||||
|
||||
QStringList sortedSubfolders = list;
|
||||
// skip the parent item (first in the list)
|
||||
@@ -647,8 +618,8 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
|
||||
newInfo._folder = parentInfo->_folder;
|
||||
newInfo._pathIdx = parentInfo->_pathIdx;
|
||||
newInfo._pathIdx << newSubs.size();
|
||||
newInfo._size = job->_sizes.value(path);
|
||||
newInfo._isExternal = permissionMap.value(removeTrailingSlash(path)).toString().contains("M");
|
||||
auto size = job ? job->_sizes.value(path) : 0;
|
||||
newInfo._size = size;
|
||||
newInfo._path = relativePath;
|
||||
newInfo._name = relativePath.split('/', QString::SkipEmptyParts).last();
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
struct SubFolderInfo {
|
||||
SubFolderInfo()
|
||||
: _folder(0), _size(0), _isExternal(false), _fetched(false), _fetching(false),
|
||||
: _folder(0), _size(0), _fetched(false), _fetching(false),
|
||||
_hasError(false), _fetchingLabel(false), _isUndecided(false), _checked(Qt::Checked) {}
|
||||
Folder *_folder;
|
||||
QString _name;
|
||||
@@ -59,7 +59,6 @@ public:
|
||||
QVector<int> _pathIdx;
|
||||
QVector<SubFolderInfo> _subs;
|
||||
qint64 _size;
|
||||
bool _isExternal;
|
||||
|
||||
bool _fetched; // If we did the LSCOL for this folder already
|
||||
bool _fetching; // Whether a LSCOL job is currently running
|
||||
@@ -114,7 +113,6 @@ public slots:
|
||||
|
||||
private slots:
|
||||
void slotUpdateDirectories(const QStringList &);
|
||||
void slotGatherPermissions(const QString &name, const QMap<QString,QString> &properties);
|
||||
void slotLscolFinishedWithError(QNetworkReply *r);
|
||||
void slotFolderSyncStateChange(Folder* f);
|
||||
void slotFolderScheduleQueueChanged();
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include <QNetworkProxy>
|
||||
#include <QDir>
|
||||
#include <QScopedValueRollback>
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@@ -67,7 +66,6 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
|
||||
connect(_ui->crashreporterCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
||||
connect(_ui->newFolderLimitCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
||||
connect(_ui->newFolderLimitSpinBox, SIGNAL(valueChanged(int)), SLOT(saveMiscSettings()));
|
||||
connect(_ui->newExternalStorage, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
|
||||
|
||||
#ifndef WITH_CRASHREPORTER
|
||||
_ui->crashreporterCheckBox->setVisible(false);
|
||||
@@ -87,9 +85,6 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
|
||||
_ui->monoIconsCheckBox->setVisible(QDir(themeDir).exists());
|
||||
|
||||
connect(_ui->ignoredFilesButton, SIGNAL(clicked()), SLOT(slotIgnoreFilesEditor()));
|
||||
|
||||
// accountAdded means the wizard was finished and the wizard might change some options.
|
||||
connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)), this, SLOT(loadMiscSettings()));
|
||||
}
|
||||
|
||||
GeneralSettings::~GeneralSettings()
|
||||
@@ -104,7 +99,6 @@ QSize GeneralSettings::sizeHint() const {
|
||||
|
||||
void GeneralSettings::loadMiscSettings()
|
||||
{
|
||||
QScopedValueRollback<bool> scope(_currentlyLoading, true);
|
||||
ConfigFile cfgFile;
|
||||
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
||||
_ui->desktopNotificationsCheckBox->setChecked(cfgFile.optionalDesktopNotifications());
|
||||
@@ -112,8 +106,6 @@ void GeneralSettings::loadMiscSettings()
|
||||
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
|
||||
_ui->newFolderLimitCheckBox->setChecked(newFolderLimit.first);
|
||||
_ui->newFolderLimitSpinBox->setValue(newFolderLimit.second);
|
||||
_ui->newExternalStorage->setChecked(cfgFile.confirmExternalStorage());
|
||||
_ui->monoIconsCheckBox->setChecked(cfgFile.monoIcons());
|
||||
}
|
||||
|
||||
void GeneralSettings::slotUpdateInfo()
|
||||
@@ -138,8 +130,6 @@ void GeneralSettings::slotUpdateInfo()
|
||||
|
||||
void GeneralSettings::saveMiscSettings()
|
||||
{
|
||||
if (_currentlyLoading)
|
||||
return;
|
||||
ConfigFile cfgFile;
|
||||
bool isChecked = _ui->monoIconsCheckBox->isChecked();
|
||||
cfgFile.setMonoIcons(isChecked);
|
||||
@@ -148,7 +138,6 @@ void GeneralSettings::saveMiscSettings()
|
||||
|
||||
cfgFile.setNewBigFolderSizeLimit(_ui->newFolderLimitCheckBox->isChecked(),
|
||||
_ui->newFolderLimitSpinBox->value());
|
||||
cfgFile.setConfirmExternalStorage(_ui->newExternalStorage->isChecked());
|
||||
}
|
||||
|
||||
void GeneralSettings::slotToggleLaunchOnStartup(bool enable)
|
||||
|
||||
@@ -45,14 +45,13 @@ private slots:
|
||||
void slotToggleOptionalDesktopNotifications(bool);
|
||||
void slotUpdateInfo();
|
||||
void slotIgnoreFilesEditor();
|
||||
void loadMiscSettings();
|
||||
|
||||
private:
|
||||
void loadMiscSettings();
|
||||
|
||||
Ui::GeneralSettings *_ui;
|
||||
QPointer<IgnoreListEditor> _ignoreEditor;
|
||||
QPointer<SyncLogDialog> _syncLogDialog;
|
||||
bool _currentlyLoading = false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>785</width>
|
||||
<width>706</width>
|
||||
<height>523</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -52,37 +52,33 @@
|
||||
<property name="title">
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QPushButton" name="ignoredFilesButton">
|
||||
<property name="text">
|
||||
<string>Edit &Ignored Files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>555</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="ignoredFilesButton">
|
||||
<property name="text">
|
||||
<string>Edit &Ignored Files</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1" colspan="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>555</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="newFolderLimitCheckBox">
|
||||
<property name="text">
|
||||
<string>Ask for confirmation before synchronizing folders larger than</string>
|
||||
<string>Ask &confirmation before downloading folders larger than</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
@@ -102,7 +98,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string extracomment="Trailing part of "Ask confirmation before syncing folder larger than" ">MB</string>
|
||||
<string>MB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -121,14 +117,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="newExternalStorage">
|
||||
<property name="text">
|
||||
<string>Ask for confirmation before synchronizing external storages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="crashreporterCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
@@ -141,6 +130,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -533,11 +533,9 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
|
||||
if (f) {
|
||||
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
|
||||
_ocWizard->selectiveSyncBlacklist());
|
||||
if (!_ocWizard->isConfirmBigFolderChecked()) {
|
||||
// The user already accepted the selective sync dialog. everything is in the white list
|
||||
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList,
|
||||
// The user already accepted the selective sync dialog. everything is in the white list
|
||||
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList,
|
||||
QStringList() << QLatin1String("/"));
|
||||
}
|
||||
}
|
||||
_ocWizard->appendToConfigurationLog(tr("<font color=\"green\"><b>Local sync folder %1 successfully created!</b></font>").arg(localFolder));
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <QPixmap>
|
||||
#include <QImage>
|
||||
#include <QWidgetAction>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
|
||||
namespace {
|
||||
const char TOOLBAR_CSS[] =
|
||||
@@ -54,6 +56,23 @@ namespace {
|
||||
|
||||
namespace OCC {
|
||||
|
||||
static QIcon circleMask( const QPixmap& avatar )
|
||||
{
|
||||
int dim = avatar.width();
|
||||
|
||||
QPixmap fixedImage(dim, dim);
|
||||
fixedImage.fill(Qt::transparent);
|
||||
|
||||
QPainter imgPainter(&fixedImage);
|
||||
QPainterPath clip;
|
||||
clip.addEllipse(0, 0, dim, dim);
|
||||
imgPainter.setClipPath(clip);
|
||||
imgPainter.drawPixmap(0, 0, dim, dim, avatar);
|
||||
imgPainter.end();
|
||||
|
||||
return QIcon(fixedImage);
|
||||
}
|
||||
|
||||
//
|
||||
// Whenever you change something here check both settingsdialog.cpp and settingsdialogmac.cpp !
|
||||
//
|
||||
@@ -196,8 +215,17 @@ void SettingsDialog::accountAdded(AccountState *s)
|
||||
|
||||
bool brandingSingleAccount = !Theme::instance()->multiAccount();
|
||||
|
||||
auto accountAction = createColorAwareAction(QLatin1String(":/client/resources/account.png"),
|
||||
brandingSingleAccount ? tr("Account") : s->account()->displayName());
|
||||
QAction *accountAction;
|
||||
QPixmap avatar = s->account()->avatar();
|
||||
const QString actionText = brandingSingleAccount ? tr("Account") : s->account()->displayName();
|
||||
if(avatar.isNull()) {
|
||||
accountAction = createColorAwareAction(QLatin1String(":/client/resources/account.png"),
|
||||
actionText);
|
||||
} else {
|
||||
QIcon icon = circleMask(avatar);
|
||||
accountAction = createActionWithIcon(icon, actionText);
|
||||
}
|
||||
|
||||
if (!brandingSingleAccount) {
|
||||
accountAction->setToolTip(s->account()->displayName());
|
||||
accountAction->setIconText(s->shortDisplayNameForSettings(height * buttonSizeRatio));
|
||||
@@ -207,14 +235,30 @@ void SettingsDialog::accountAdded(AccountState *s)
|
||||
_ui->stack->insertWidget(0 , accountSettings);
|
||||
_actionGroup->addAction(accountAction);
|
||||
_actionGroupWidgets.insert(accountAction, accountSettings);
|
||||
_actionForAccount.insert(s->account().data(), accountAction);
|
||||
|
||||
connect( accountSettings, SIGNAL(folderChanged()), _gui, SLOT(slotFoldersChanged()));
|
||||
connect( accountSettings, SIGNAL(openFolderAlias(const QString&)),
|
||||
_gui, SLOT(slotFolderOpenAction(QString)));
|
||||
connect(s->account().data(), SIGNAL(accountChangedAvatar()), SLOT(slotAccountAvatarChanged()));
|
||||
|
||||
slotRefreshActivity(s);
|
||||
}
|
||||
|
||||
void SettingsDialog::slotAccountAvatarChanged()
|
||||
{
|
||||
Account *account = static_cast<Account*>(sender());
|
||||
if( account && _actionForAccount.contains(account)) {
|
||||
QAction *action = _actionForAccount[account];
|
||||
if( action ) {
|
||||
QPixmap pix = account->avatar();
|
||||
if( !pix.isNull() ) {
|
||||
action->setIcon( circleMask(pix) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::accountRemoved(AccountState *s)
|
||||
{
|
||||
for (auto it = _actionGroupWidgets.begin(); it != _actionGroupWidgets.end(); ++it) {
|
||||
@@ -236,6 +280,9 @@ void SettingsDialog::accountRemoved(AccountState *s)
|
||||
}
|
||||
}
|
||||
|
||||
if( _actionForAccount.contains(s->account().data()) ) {
|
||||
_actionForAccount.remove(s->account().data());
|
||||
}
|
||||
_activitySettings->slotRemoveAccount(s);
|
||||
|
||||
// Hide when the last account is deleted. We want to enter the same
|
||||
@@ -306,14 +353,22 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
QAction *SettingsDialog::createActionWithIcon(const QIcon& icon, const QString& text, const QString& iconPath)
|
||||
{
|
||||
QAction *action = new ToolButtonAction(icon, text, this);
|
||||
action->setCheckable(true);
|
||||
if(!iconPath.isEmpty()) {
|
||||
action->setProperty("iconPath", iconPath);
|
||||
}
|
||||
return action;
|
||||
|
||||
}
|
||||
|
||||
QAction *SettingsDialog::createColorAwareAction(const QString &iconPath, const QString &text)
|
||||
{
|
||||
// all buttons must have the same size in order to keep a good layout
|
||||
QIcon coloredIcon = createColorAwareIcon(iconPath);
|
||||
QAction *action = new ToolButtonAction(coloredIcon, text, this);
|
||||
action->setCheckable(true);
|
||||
action->setProperty("iconPath", iconPath);
|
||||
return action;
|
||||
return createActionWithIcon(coloredIcon, text, iconPath);
|
||||
}
|
||||
|
||||
void SettingsDialog::slotRefreshActivity( AccountState* accountState )
|
||||
|
||||
@@ -58,6 +58,7 @@ public slots:
|
||||
void showActivityPage();
|
||||
void slotSwitchPage(QAction *action);
|
||||
void slotRefreshActivity(AccountState *accountState );
|
||||
void slotAccountAvatarChanged();
|
||||
|
||||
protected:
|
||||
void reject() Q_DECL_OVERRIDE;
|
||||
@@ -73,12 +74,18 @@ private:
|
||||
|
||||
QIcon createColorAwareIcon(const QString &name);
|
||||
QAction *createColorAwareAction(const QString &iconName, const QString &fileName);
|
||||
QAction *createActionWithIcon(const QIcon& icon, const QString& text, const QString& iconPath = QString());
|
||||
|
||||
Ui::SettingsDialog * const _ui;
|
||||
|
||||
QActionGroup* _actionGroup;
|
||||
// Maps the actions from the action group to the corresponding widgets
|
||||
QHash<QAction*, QWidget*> _actionGroupWidgets;
|
||||
|
||||
// Maps the action in the dialog to their according account. Needed in
|
||||
// case the account avatar changes
|
||||
QHash<Account*, QAction*> _actionForAccount;
|
||||
|
||||
QToolBar* _toolBar;
|
||||
|
||||
ActivitySettings *_activitySettings;
|
||||
|
||||
@@ -68,15 +68,6 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
|
||||
_ui.lServerIcon->setPixmap(appIcon.pixmap(48));
|
||||
_ui.lLocalIcon->setText(QString());
|
||||
_ui.lLocalIcon->setPixmap(QPixmap(Theme::hidpiFileName(":/client/resources/folder-sync.png")));
|
||||
|
||||
if (theme->wizardHideExternalStorageConfirmationCheckbox()) {
|
||||
_ui.confCheckBoxExternal->hide();
|
||||
}
|
||||
if (theme->wizardHideFolderSizeLimitCheckbox()) {
|
||||
_ui.confCheckBoxSize->hide();
|
||||
_ui.confSpinBox->hide();
|
||||
_ui.confTraillingSizeLabel->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void OwncloudAdvancedSetupPage::setupCustomization()
|
||||
@@ -127,12 +118,6 @@ void OwncloudAdvancedSetupPage::initializePage()
|
||||
_selectiveSyncBlacklist = QStringList("/");
|
||||
QTimer::singleShot(0, this, SLOT(slotSelectiveSyncClicked()));
|
||||
}
|
||||
|
||||
ConfigFile cfgFile;
|
||||
auto newFolderLimit = cfgFile.newBigFolderSizeLimit();
|
||||
_ui.confCheckBoxSize->setChecked(newFolderLimit.first);
|
||||
_ui.confSpinBox->setValue(newFolderLimit.second);
|
||||
_ui.confCheckBoxExternal->setChecked(cfgFile.confirmExternalStorage());
|
||||
}
|
||||
|
||||
// Called if the user changes the user- or url field. Adjust the texts and
|
||||
@@ -215,11 +200,6 @@ QStringList OwncloudAdvancedSetupPage::selectiveSyncBlacklist() const
|
||||
return _selectiveSyncBlacklist;
|
||||
}
|
||||
|
||||
bool OwncloudAdvancedSetupPage::isConfirmBigFolderChecked() const
|
||||
{
|
||||
return _ui.rSyncEverything->isChecked() && _ui.confCheckBoxSize->isChecked();
|
||||
}
|
||||
|
||||
bool OwncloudAdvancedSetupPage::validatePage()
|
||||
{
|
||||
if(!_created) {
|
||||
@@ -228,13 +208,6 @@ bool OwncloudAdvancedSetupPage::validatePage()
|
||||
startSpinner();
|
||||
emit completeChanged();
|
||||
|
||||
if (_ui.rSyncEverything->isChecked()) {
|
||||
ConfigFile cfgFile;
|
||||
cfgFile.setNewBigFolderSizeLimit(_ui.confCheckBoxSize->isChecked(),
|
||||
_ui.confSpinBox->value());
|
||||
cfgFile.setConfirmExternalStorage(_ui.confCheckBoxExternal->isChecked());
|
||||
}
|
||||
|
||||
emit createLocalAndRemoteFolders(localFolder(), _remoteFolder);
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -41,7 +41,6 @@ public:
|
||||
bool validatePage() Q_DECL_OVERRIDE;
|
||||
QString localFolder() const;
|
||||
QStringList selectiveSyncBlacklist() const;
|
||||
bool isConfirmBigFolderChecked() const;
|
||||
void setRemoteFolder( const QString& remoteFolder);
|
||||
void setMultipleFoldersExist( bool exist );
|
||||
void directoriesCreated();
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>912</width>
|
||||
<height>633</height>
|
||||
<width>917</width>
|
||||
<height>493</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -226,14 +226,11 @@
|
||||
<item row="0" column="1" colspan="2">
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rSyncEverything">
|
||||
<property name="text">
|
||||
@@ -266,64 +263,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="confCheckBoxSize">
|
||||
<property name="text">
|
||||
<string>Ask for confirmation before synchroni&zing folders larger than</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="confSpinBox">
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>99</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="confTraillingSizeLabel">
|
||||
<property name="text">
|
||||
<string extracomment="Trailing part of "Ask confirmation before syncing folder larger than" ">MB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="confCheckBoxExternal">
|
||||
<property name="text">
|
||||
<string>Ask for confirmation before synchronizing e&xternal storages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -406,70 +345,5 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>rSyncEverything</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>confCheckBoxSize</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>217</x>
|
||||
<y>78</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>298</x>
|
||||
<y>126</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>rSyncEverything</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>confSpinBox</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>311</x>
|
||||
<y>83</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>952</x>
|
||||
<y>134</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>rSyncEverything</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>confTraillingSizeLabel</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>277</x>
|
||||
<y>76</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>1076</x>
|
||||
<y>136</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>rSyncEverything</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>confCheckBoxExternal</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>181</x>
|
||||
<y>78</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>382</x>
|
||||
<y>174</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>506</width>
|
||||
<height>515</height>
|
||||
<width>602</width>
|
||||
<height>193</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -80,7 +80,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Ser&ver Address</string>
|
||||
<string>Server &Address</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>leUrl</cstring>
|
||||
@@ -166,13 +166,10 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>200</height>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
||||
@@ -86,6 +86,7 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
|
||||
setTitleFormat(Qt::RichText);
|
||||
setSubTitleFormat(Qt::RichText);
|
||||
setButtonText(QWizard::CustomButton1, tr("Skip folders configuration"));
|
||||
|
||||
}
|
||||
|
||||
void OwncloudWizard::setAccount(AccountPtr account)
|
||||
@@ -108,10 +109,6 @@ QStringList OwncloudWizard::selectiveSyncBlacklist() const
|
||||
return _advancedSetupPage->selectiveSyncBlacklist();
|
||||
}
|
||||
|
||||
bool OwncloudWizard::isConfirmBigFolderChecked() const
|
||||
{
|
||||
return _advancedSetupPage->isConfirmBigFolderChecked();
|
||||
}
|
||||
|
||||
QString OwncloudWizard::ocUrl() const
|
||||
{
|
||||
|
||||
@@ -59,7 +59,6 @@ public:
|
||||
QString ocUrl() const;
|
||||
QString localFolder() const;
|
||||
QStringList selectiveSyncBlacklist() const;
|
||||
bool isConfirmBigFolderChecked() const;
|
||||
|
||||
void enableFinishOnResultWidget(bool enable);
|
||||
|
||||
|
||||
@@ -90,6 +90,16 @@ void Account::setDavUser(const QString &newDavUser)
|
||||
_davUser = newDavUser;
|
||||
}
|
||||
|
||||
QPixmap Account::avatar() const
|
||||
{
|
||||
return _avatarPixmap;
|
||||
}
|
||||
void Account::setAvatar(const QPixmap& pixmap)
|
||||
{
|
||||
_avatarPixmap = pixmap;
|
||||
emit accountChangedAvatar();
|
||||
}
|
||||
|
||||
QString Account::displayName() const
|
||||
{
|
||||
QString dn = QString("%1@%2").arg(_credentials->user(), _url.host());
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include <QSslCipher>
|
||||
#include <QSslError>
|
||||
#include <QSharedPointer>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "utility.h"
|
||||
#include <memory>
|
||||
#include "capabilities.h"
|
||||
@@ -78,6 +80,9 @@ public:
|
||||
QString davUser() const;
|
||||
void setDavUser(const QString &newDavUser);
|
||||
|
||||
QPixmap avatar() const;
|
||||
void setAvatar(const QPixmap& pixmap);
|
||||
|
||||
/// The name of the account as shown in the toolbar
|
||||
QString displayName() const;
|
||||
|
||||
@@ -197,6 +202,8 @@ signals:
|
||||
|
||||
void serverVersionChanged(Account* account, const QString& newVersion, const QString& oldVersion);
|
||||
|
||||
void accountChangedAvatar();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void slotHandleSslErrors(QNetworkReply*,QList<QSslError>);
|
||||
void slotCredentialsFetched();
|
||||
@@ -209,6 +216,7 @@ private:
|
||||
QWeakPointer<Account> _sharedThis;
|
||||
QString _id;
|
||||
QString _davUser;
|
||||
QPixmap _avatarPixmap;
|
||||
QMap<QString, QVariant> _settingsMap;
|
||||
QUrl _url;
|
||||
QList<QSslCertificate> _approvedCerts;
|
||||
|
||||
@@ -67,7 +67,6 @@ static const char downloadLimitC[] = "BWLimit/downloadLimit";
|
||||
|
||||
static const char newBigFolderSizeLimitC[] = "newBigFolderSizeLimit";
|
||||
static const char useNewBigFolderSizeLimitC[] = "useNewBigFolderSizeLimit";
|
||||
static const char confirmExternalStorageC[] = "confirmExternalStorage";
|
||||
|
||||
static const char maxLogLinesC[] = "Logging/maxLogLines";
|
||||
|
||||
@@ -597,16 +596,6 @@ void ConfigFile::setNewBigFolderSizeLimit(bool isChecked, quint64 mbytes)
|
||||
setValue(useNewBigFolderSizeLimitC, isChecked);
|
||||
}
|
||||
|
||||
bool ConfigFile::confirmExternalStorage() const
|
||||
{
|
||||
return getValue(confirmExternalStorageC, QString(), true).toBool();
|
||||
}
|
||||
|
||||
void ConfigFile::setConfirmExternalStorage(bool isChecked)
|
||||
{
|
||||
setValue(confirmExternalStorageC, isChecked);
|
||||
}
|
||||
|
||||
bool ConfigFile::promptDeleteFiles() const
|
||||
{
|
||||
QSettings settings(configFile(), QSettings::IniFormat);
|
||||
|
||||
@@ -105,8 +105,6 @@ public:
|
||||
/** [checked, size in MB] **/
|
||||
QPair<bool, quint64> newBigFolderSizeLimit() const;
|
||||
void setNewBigFolderSizeLimit(bool isChecked, quint64 mbytes);
|
||||
bool confirmExternalStorage() const;
|
||||
void setConfirmExternalStorage(bool);
|
||||
|
||||
static bool setConfDir(const QString &value);
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <QtCore>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkProxyFactory>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "connectionvalidator.h"
|
||||
#include "account.h"
|
||||
@@ -252,7 +253,18 @@ void ConnectionValidator::slotUserFetched(const QVariantMap &json)
|
||||
QString user = json.value("ocs").toMap().value("data").toMap().value("id").toString();
|
||||
if (!user.isEmpty()) {
|
||||
_account->setDavUser(user);
|
||||
|
||||
AvatarJob *job = new AvatarJob(_account, this);
|
||||
job->setTimeout(20*1000);
|
||||
QObject::connect(job, SIGNAL(avatarPixmap(QPixmap)), this, SLOT(slotAvatarPixmap(QPixmap)));
|
||||
|
||||
job->start();
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionValidator::slotAvatarPixmap(const QPixmap& pixmap)
|
||||
{
|
||||
_account->setAvatar(pixmap);
|
||||
reportResult(Connected);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,10 @@ namespace OCC {
|
||||
+-> fetchUser
|
||||
PropfindJob
|
||||
|
|
||||
+-> slotUserFetched --> X
|
||||
+-> slotUserFetched
|
||||
AvatarJob
|
||||
|
|
||||
+-> slotAvatarPixmap --> reportResult()
|
||||
|
||||
\endcode
|
||||
*/
|
||||
@@ -119,6 +122,7 @@ protected slots:
|
||||
|
||||
void slotCapabilitiesRecieved(const QVariantMap&);
|
||||
void slotUserFetched(const QVariantMap &);
|
||||
void slotAvatarPixmap(const QPixmap&);
|
||||
|
||||
private:
|
||||
void reportResult(Status status);
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
#include <QUrl>
|
||||
#include "account.h"
|
||||
#include <QFileInfo>
|
||||
#include "theme.h"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace OCC {
|
||||
|
||||
@@ -84,32 +81,14 @@ int DiscoveryJob::isInSelectiveSyncBlackListCallback(void *data, const char *pat
|
||||
return static_cast<DiscoveryJob*>(data)->isInSelectiveSyncBlackList(path);
|
||||
}
|
||||
|
||||
bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *remotePerm)
|
||||
bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path)
|
||||
{
|
||||
|
||||
if (_syncOptions._confirmExternalStorage && std::strchr(remotePerm, 'M')) {
|
||||
// 'M' in the permission means external storage.
|
||||
|
||||
/* Note: DiscoverySingleDirectoryJob::directoryListingIteratedSlot make sure that only the
|
||||
* root of a mounted storage has 'M', all sub entries have 'm' */
|
||||
|
||||
// Only allow it if the white list contains exactly this path (not parents)
|
||||
// We want to ask confirmation for external storage even if the parents where selected
|
||||
if (_selectiveSyncWhiteList.contains(path + QLatin1Char('/'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
emit newBigFolder(path, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If this path or the parent is in the white list, then we do not block this file
|
||||
// If this path or the parent is in the white list, then we do not block this file
|
||||
if (findPathInList(_selectiveSyncWhiteList, path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto limit = _syncOptions._newBigFolderSizeLimit;
|
||||
if (limit < 0) {
|
||||
if (_newBigFolderSizeLimit < 0) {
|
||||
// no limit, everything is allowed;
|
||||
return false;
|
||||
}
|
||||
@@ -123,9 +102,10 @@ bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *
|
||||
_vioWaitCondition.wait(&_vioMutex);
|
||||
}
|
||||
|
||||
auto limit = _newBigFolderSizeLimit;
|
||||
if (result >= limit) {
|
||||
// we tell the UI there is a new folder
|
||||
emit newBigFolder(path, false);
|
||||
emit newBigFolder(path);
|
||||
return true;
|
||||
} else {
|
||||
// it is not too big, put it in the white list (so we will not do more query for the children)
|
||||
@@ -139,9 +119,9 @@ bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *
|
||||
}
|
||||
}
|
||||
|
||||
int DiscoveryJob::checkSelectiveSyncNewFolderCallback(void *data, const char *path, const char *remotePerm)
|
||||
int DiscoveryJob::checkSelectiveSyncNewFolderCallback(void *data, const char *path)
|
||||
{
|
||||
return static_cast<DiscoveryJob*>(data)->checkSelectiveSyncNewFolder(QString::fromUtf8(path), remotePerm);
|
||||
return static_cast<DiscoveryJob*>(data)->checkSelectiveSyncNewFolder(QString::fromUtf8(path));
|
||||
}
|
||||
|
||||
|
||||
@@ -341,9 +321,7 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file, con
|
||||
// The first entry is for the folder itself, we should process it differently.
|
||||
_ignoredFirst = true;
|
||||
if (map.contains("permissions")) {
|
||||
auto perm = map.value("permissions");
|
||||
emit firstDirectoryPermissions(perm);
|
||||
_isExternalStorage = perm.contains(QLatin1Char('M'));
|
||||
emit firstDirectoryPermissions(map.value("permissions"));
|
||||
}
|
||||
if (map.contains("data-fingerprint")) {
|
||||
_dataFingerprint = map.value("data-fingerprint").toUtf8();
|
||||
@@ -366,13 +344,6 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file, con
|
||||
if (!file_stat->etag || strlen(file_stat->etag) == 0) {
|
||||
qDebug() << "WARNING: etag of" << file_stat->name << "is" << file_stat->etag << " This must not happen.";
|
||||
}
|
||||
if (_isExternalStorage) {
|
||||
/* All the entries in a external storage have 'M' in their permission. However, for all
|
||||
purposes in the desktop client, we only need to know about the mount points.
|
||||
So replace the 'M' by a 'm' for every sub entries in an external storage */
|
||||
std::replace(std::begin(file_stat->remotePerm), std::end(file_stat->remotePerm),
|
||||
'M', 'm');
|
||||
}
|
||||
|
||||
QStringRef fileRef(&file);
|
||||
int slashPos = file.lastIndexOf(QLatin1Char('/'));
|
||||
|
||||
@@ -34,15 +34,6 @@ class Account;
|
||||
* if the files are new, or changed.
|
||||
*/
|
||||
|
||||
struct SyncOptions {
|
||||
/** Maximum size (in Bytes) a folder can have without asking for confirmation.
|
||||
* -1 means infinite */
|
||||
qint64 _newBigFolderSizeLimit = -1;
|
||||
/** If a confirmation should be asked for external storages */
|
||||
bool _confirmExternalStorage = false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The FileStatPointer class
|
||||
* @ingroup libsync
|
||||
@@ -116,8 +107,6 @@ private:
|
||||
bool _ignoredFirst;
|
||||
// Set to true if this is the root path and we need to check the data-fingerprint
|
||||
bool _isRootPath;
|
||||
// If this directory is an external storage (The first item has 'M' in its permission)
|
||||
bool _isExternalStorage = false;
|
||||
QPointer<LsColJob> _lsColJob;
|
||||
|
||||
public:
|
||||
@@ -187,8 +176,8 @@ class DiscoveryJob : public QObject {
|
||||
*/
|
||||
bool isInSelectiveSyncBlackList(const char* path) const;
|
||||
static int isInSelectiveSyncBlackListCallback(void *, const char *);
|
||||
bool checkSelectiveSyncNewFolder(const QString &path, const char *remotePerm);
|
||||
static int checkSelectiveSyncNewFolderCallback(void* data, const char* path, const char* remotePerm);
|
||||
bool checkSelectiveSyncNewFolder(const QString &path);
|
||||
static int checkSelectiveSyncNewFolderCallback(void*, const char*);
|
||||
|
||||
// Just for progress
|
||||
static void update_job_update_callback (bool local,
|
||||
@@ -208,7 +197,7 @@ class DiscoveryJob : public QObject {
|
||||
|
||||
public:
|
||||
explicit DiscoveryJob(CSYNC *ctx, QObject* parent = 0)
|
||||
: QObject(parent), _csync_ctx(ctx) {
|
||||
: QObject(parent), _csync_ctx(ctx), _newBigFolderSizeLimit(-1) {
|
||||
// We need to forward the log property as csync uses thread local
|
||||
// and updates run in another thread
|
||||
_log_callback = csync_get_log_callback();
|
||||
@@ -218,7 +207,7 @@ public:
|
||||
|
||||
QStringList _selectiveSyncBlackList;
|
||||
QStringList _selectiveSyncWhiteList;
|
||||
SyncOptions _syncOptions;
|
||||
qint64 _newBigFolderSizeLimit;
|
||||
Q_INVOKABLE void start();
|
||||
signals:
|
||||
void finished(int result);
|
||||
@@ -229,7 +218,7 @@ signals:
|
||||
void doGetSizeSignal(const QString &path, qint64 *result);
|
||||
|
||||
// A new folder was discovered and was not synced because of the confirmation feature
|
||||
void newBigFolder(const QString &folder, bool isExternal);
|
||||
void newBigFolder(const QString &folder);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <QMutex>
|
||||
#include <QDebug>
|
||||
#include <QCoreApplication>
|
||||
#include <QPixmap>
|
||||
|
||||
#include "json.h"
|
||||
|
||||
@@ -589,6 +590,42 @@ bool PropfindJob::finished()
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
AvatarJob::AvatarJob(AccountPtr account, QObject *parent)
|
||||
: AbstractNetworkJob(account, QString(), parent)
|
||||
{
|
||||
_avatarUrl = Utility::concatUrlPath(account->url(), QString("remote.php/dav/avatars/%1/128.png").arg(account->davUser()));
|
||||
}
|
||||
|
||||
void AvatarJob::start()
|
||||
{
|
||||
QNetworkRequest req;
|
||||
setReply(davRequest("GET", _avatarUrl, req));
|
||||
setupConnections(reply());
|
||||
AbstractNetworkJob::start();
|
||||
}
|
||||
|
||||
bool AvatarJob::finished()
|
||||
{
|
||||
int http_result_code = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
|
||||
QPixmap avPixmap;
|
||||
|
||||
if (http_result_code == 200) {
|
||||
|
||||
QByteArray pngData = reply()->readAll();
|
||||
if( pngData.size() ) {
|
||||
|
||||
if( avPixmap.loadFromData(pngData) ) {
|
||||
qDebug() << "Retrieved Avatar pixmap!";
|
||||
}
|
||||
}
|
||||
}
|
||||
emit(avatarPixmap(avPixmap));
|
||||
return true;
|
||||
}
|
||||
|
||||
/*********************************************************************************************/
|
||||
|
||||
ProppatchJob::ProppatchJob(AccountPtr account, const QString &path, QObject *parent)
|
||||
: AbstractNetworkJob(account, path, parent)
|
||||
{
|
||||
|
||||
@@ -129,6 +129,36 @@ private:
|
||||
QList<QByteArray> _properties;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The AvatarJob class
|
||||
*
|
||||
* Retrieves the account users avatar from the server using a GET request.
|
||||
*
|
||||
* If the server does not have the avatar, the result Pixmap is empty.
|
||||
*
|
||||
* @ingroup libsync
|
||||
*/
|
||||
class OWNCLOUDSYNC_EXPORT AvatarJob : public AbstractNetworkJob {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AvatarJob(AccountPtr account, QObject *parent = 0);
|
||||
void start() Q_DECL_OVERRIDE;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief avatarPixmap - returns either a valid pixmap or not.
|
||||
*/
|
||||
|
||||
void avatarPixmap(QPixmap);
|
||||
|
||||
private slots:
|
||||
virtual bool finished() Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QUrl _avatarUrl;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Send a Proppatch request
|
||||
*
|
||||
|
||||
@@ -71,6 +71,7 @@ SyncEngine::SyncEngine(AccountPtr account, const QString& localPath,
|
||||
, _backInTimeFiles(0)
|
||||
, _uploadLimit(0)
|
||||
, _downloadLimit(0)
|
||||
, _newBigFolderSizeLimit(-1)
|
||||
, _checksum_hook(journal)
|
||||
, _anotherSyncNeeded(NoFollowUpSync)
|
||||
{
|
||||
@@ -829,14 +830,14 @@ void SyncEngine::startSync()
|
||||
return;
|
||||
}
|
||||
|
||||
discoveryJob->_syncOptions = _syncOptions;
|
||||
discoveryJob->_newBigFolderSizeLimit = _newBigFolderSizeLimit;
|
||||
discoveryJob->moveToThread(&_thread);
|
||||
connect(discoveryJob, SIGNAL(finished(int)), this, SLOT(slotDiscoveryJobFinished(int)));
|
||||
connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
|
||||
this, SIGNAL(folderDiscovered(bool,QString)));
|
||||
|
||||
connect(discoveryJob, SIGNAL(newBigFolder(QString,bool)),
|
||||
this, SIGNAL(newBigFolder(QString,bool)));
|
||||
connect(discoveryJob, SIGNAL(newBigFolder(QString)),
|
||||
this, SIGNAL(newBigFolder(QString)));
|
||||
|
||||
|
||||
// This is used for the DiscoveryJob to be able to request the main thread/
|
||||
|
||||
@@ -78,7 +78,10 @@ public:
|
||||
|
||||
bool isSyncRunning() const { return _syncRunning; }
|
||||
|
||||
void setSyncOptions(const SyncOptions &options) { _syncOptions = options; }
|
||||
/* Set the maximum size a folder can have without asking for confirmation
|
||||
* -1 means infinite
|
||||
*/
|
||||
void setNewBigFolderSizeLimit(qint64 limit) { _newBigFolderSizeLimit = limit; }
|
||||
bool ignoreHiddenFiles() const { return _csync_ctx->ignore_hidden_files; }
|
||||
void setIgnoreHiddenFiles(bool ignore) { _csync_ctx->ignore_hidden_files = ignore; }
|
||||
|
||||
@@ -143,7 +146,7 @@ signals:
|
||||
void aboutToRestoreBackup(bool *restore);
|
||||
|
||||
// A new folder was discovered and was not synced because of the confirmation feature
|
||||
void newBigFolder(const QString &folder, bool isExternal);
|
||||
void newBigFolder(const QString &folder);
|
||||
|
||||
/** Emitted when propagation has problems with a locked file.
|
||||
*
|
||||
@@ -254,7 +257,8 @@ private:
|
||||
|
||||
int _uploadLimit;
|
||||
int _downloadLimit;
|
||||
SyncOptions _syncOptions;
|
||||
/* maximum size a folder can have without asking for confirmation: -1 means infinite */
|
||||
qint64 _newBigFolderSizeLimit;
|
||||
|
||||
// hash containing the permissions on the remote directory
|
||||
QHash<QString, QByteArray> _remotePerms;
|
||||
|
||||
+1
-12
@@ -275,15 +275,6 @@ qint64 Theme::newBigFolderSizeLimit() const
|
||||
return 500;
|
||||
}
|
||||
|
||||
bool Theme::wizardHideExternalStorageConfirmationCheckbox() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Theme::wizardHideFolderSizeLimitCheckbox() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QString Theme::gitSHA1() const
|
||||
{
|
||||
@@ -421,7 +412,7 @@ QPixmap Theme::wizardHeaderBanner() const
|
||||
if (!c.isValid())
|
||||
return QPixmap();
|
||||
|
||||
QPixmap pix(QSize(750, 78));
|
||||
QPixmap pix(QSize(600, 78));
|
||||
pix.fill(wizardHeaderBackgroundColor());
|
||||
return pix;
|
||||
}
|
||||
@@ -487,6 +478,4 @@ QString Theme::quotaBaseFolder() const
|
||||
{
|
||||
return QLatin1String("/");
|
||||
}
|
||||
|
||||
|
||||
} // end namespace client
|
||||
|
||||
@@ -219,17 +219,6 @@ public:
|
||||
**/
|
||||
virtual qint64 newBigFolderSizeLimit() const;
|
||||
|
||||
/**
|
||||
* Hide the checkbox that says "Ask for confirmation before synchronizing folders larger than X MB"
|
||||
* in the account wizard
|
||||
*/
|
||||
virtual bool wizardHideFolderSizeLimitCheckbox() const;
|
||||
/**
|
||||
* Hide the checkbox that says "Ask for confirmation before synchronizing external storages"
|
||||
* in the account wizard
|
||||
*/
|
||||
virtual bool wizardHideExternalStorageConfirmationCheckbox() const;
|
||||
|
||||
/**
|
||||
* Alternative path on the server that provides access to the webdav capabilities
|
||||
*
|
||||
@@ -313,7 +302,6 @@ public:
|
||||
*/
|
||||
virtual QString quotaBaseFolder() const;
|
||||
|
||||
|
||||
protected:
|
||||
#ifndef TOKEN_AUTH_ONLY
|
||||
QIcon themeIcon(const QString& name, bool sysTray = false, bool sysTrayMenuVisible = false) const;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário