Confirm External Storage: adjust the notification message

We need to forward the information that the folder is an external storage
for the notification message.

Issue: https://github.com/owncloud/client/pull/5340#issuecomment-274878023
This commit is contained in:
Olivier Goffart 2017-01-26 09:03:01 +01:00 committed by Markus Goetz
parent ed7416098e
commit 38cf459b3e
7 changed files with 54 additions and 64 deletions

View file

@ -104,7 +104,8 @@ Folder::Folder(const FolderDefinition& definition,
connect(_engine.data(), SIGNAL(transmissionProgress(ProgressInfo)), this, SLOT(slotTransmissionProgress(ProgressInfo))); connect(_engine.data(), SIGNAL(transmissionProgress(ProgressInfo)), this, SLOT(slotTransmissionProgress(ProgressInfo)));
connect(_engine.data(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)), connect(_engine.data(), SIGNAL(itemCompleted(const SyncFileItem &, const PropagatorJob &)),
this, SLOT(slotItemCompleted(const SyncFileItem &, const PropagatorJob &))); this, SLOT(slotItemCompleted(const SyncFileItem &, const PropagatorJob &)));
connect(_engine.data(), SIGNAL(newBigFolder(QString)), this, SLOT(slotNewBigFolderDiscovered(QString))); connect(_engine.data(), SIGNAL(newBigFolder(QString,bool)),
this, SLOT(slotNewBigFolderDiscovered(QString,bool)));
connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString))); connect(_engine.data(), SIGNAL(seenLockedFile(QString)), FolderMan::instance(), SLOT(slotSyncOnceFileUnlocks(QString)));
connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)), connect(_engine.data(), SIGNAL(aboutToPropagate(SyncFileItemVector&)),
SLOT(slotLogPropagationStart())); SLOT(slotLogPropagationStart()));
@ -930,7 +931,7 @@ void Folder::slotItemCompleted(const SyncFileItem &item, const PropagatorJob& jo
emit ProgressDispatcher::instance()->itemCompleted(alias(), item, job); emit ProgressDispatcher::instance()->itemCompleted(alias(), item, job);
} }
void Folder::slotNewBigFolderDiscovered(const QString &newF) void Folder::slotNewBigFolderDiscovered(const QString &newF, bool isExternal)
{ {
auto newFolder = newF; auto newFolder = newF;
if (!newFolder.endsWith(QLatin1Char('/'))) { if (!newFolder.endsWith(QLatin1Char('/'))) {
@ -955,9 +956,11 @@ void Folder::slotNewBigFolderDiscovered(const QString &newF)
journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList); journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList);
emit newBigFolderDiscovered(newFolder); emit newBigFolderDiscovered(newFolder);
} }
QString message = tr("A new folder larger than %1 MB has been added: %2.\n" QString message = !isExternal ?
"Please go in the settings to select it if you wish to download it.") (tr("A new folder larger than %1 MB has been added: %2.\n")
.arg(ConfigFile().newBigFolderSizeLimit().second).arg(newF); .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.");
auto logger = Logger::instance(); auto logger = Logger::instance();
logger->postOptionalGuiLog(Theme::instance()->appNameGUI(), message); logger->postOptionalGuiLog(Theme::instance()->appNameGUI(), message);

View file

@ -290,7 +290,7 @@ private slots:
void slotEmitFinishedDelayed(); void slotEmitFinishedDelayed();
void slotNewBigFolderDiscovered(const QString &); void slotNewBigFolderDiscovered(const QString &, bool isExternal);
void slotLogPropagationStart(); void slotLogPropagationStart();

View file

@ -52,34 +52,32 @@
<property name="title"> <property name="title">
<string>Advanced</string> <string>Advanced</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="1" colspan="2"> <item>
<spacer name="horizontalSpacer_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="orientation"> <item>
<enum>Qt::Horizontal</enum> <widget class="QPushButton" name="ignoredFilesButton">
</property> <property name="text">
<property name="sizeHint" stdset="0"> <string>Edit &amp;Ignored Files</string>
<size> </property>
<width>555</width> </widget>
<height>20</height> </item>
</size> <item>
</property> <spacer name="horizontalSpacer_4">
</spacer> <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>
</item> </item>
<item row="3" column="0" colspan="2"> <item>
<widget class="QCheckBox" name="crashreporterCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>S&amp;how crash reporter</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QCheckBox" name="newFolderLimitCheckBox"> <widget class="QCheckBox" name="newFolderLimitCheckBox">
@ -123,37 +121,26 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="2"> <item>
<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>
<item row="0" column="0">
<widget class="QPushButton" name="ignoredFilesButton">
<property name="text">
<string>Edit &amp;Ignored Files</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="newExternalStorage"> <widget class="QCheckBox" name="newExternalStorage">
<property name="text"> <property name="text">
<string>Ask for confirmation before synchronizing external storages</string> <string>Ask for confirmation before synchronizing external storages</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="crashreporterCheckBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>S&amp;how crash reporter</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View file

@ -99,7 +99,7 @@ bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *
return false; return false;
} }
emit newBigFolder(path); emit newBigFolder(path, true);
return true; return true;
} }
@ -125,7 +125,7 @@ bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *
if (result >= limit) { if (result >= limit) {
// we tell the UI there is a new folder // we tell the UI there is a new folder
emit newBigFolder(path); emit newBigFolder(path, false);
return true; return true;
} else { } else {
// it is not too big, put it in the white list (so we will not do more query for the children) // it is not too big, put it in the white list (so we will not do more query for the children)

View file

@ -229,7 +229,7 @@ signals:
void doGetSizeSignal(const QString &path, qint64 *result); void doGetSizeSignal(const QString &path, qint64 *result);
// A new folder was discovered and was not synced because of the confirmation feature // A new folder was discovered and was not synced because of the confirmation feature
void newBigFolder(const QString &folder); void newBigFolder(const QString &folder, bool isExternal);
}; };
} }

View file

@ -835,8 +835,8 @@ void SyncEngine::startSync()
connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)), connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
this, SIGNAL(folderDiscovered(bool,QString))); this, SIGNAL(folderDiscovered(bool,QString)));
connect(discoveryJob, SIGNAL(newBigFolder(QString)), connect(discoveryJob, SIGNAL(newBigFolder(QString,bool)),
this, SIGNAL(newBigFolder(QString))); this, SIGNAL(newBigFolder(QString,bool)));
// This is used for the DiscoveryJob to be able to request the main thread/ // This is used for the DiscoveryJob to be able to request the main thread/

View file

@ -143,7 +143,7 @@ signals:
void aboutToRestoreBackup(bool *restore); void aboutToRestoreBackup(bool *restore);
// A new folder was discovered and was not synced because of the confirmation feature // A new folder was discovered and was not synced because of the confirmation feature
void newBigFolder(const QString &folder); void newBigFolder(const QString &folder, bool isExternal);
/** Emitted when propagation has problems with a locked file. /** Emitted when propagation has problems with a locked file.
* *