Confirm External Storage: adjust the notification message
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 26 Jan 2017 08:03:01 +0000 (09:03 +0100)
committerMarkus Goetz <markus@woboq.com>
Fri, 27 Jan 2017 14:59:59 +0000 (15:59 +0100)
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

src/gui/folder.cpp
src/gui/folder.h
src/gui/generalsettings.ui
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h
src/libsync/syncengine.cpp
src/libsync/syncengine.h

index 6079edb28bc6abf2dc0bfdabc658558eef95b4e4..1d6b3ac5822bb844c8845495382390d339af5489 100644 (file)
@@ -104,7 +104,8 @@ 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)), 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(aboutToPropagate(SyncFileItemVector&)),
             SLOT(slotLogPropagationStart()));
@@ -930,7 +931,7 @@ void Folder::slotItemCompleted(const SyncFileItem &item, const PropagatorJob& jo
     emit ProgressDispatcher::instance()->itemCompleted(alias(), item, job);
 }
 
-void Folder::slotNewBigFolderDiscovered(const QString &newF)
+void Folder::slotNewBigFolderDiscovered(const QString &newF, bool isExternal)
 {
     auto newFolder = newF;
     if (!newFolder.endsWith(QLatin1Char('/'))) {
@@ -955,9 +956,11 @@ void Folder::slotNewBigFolderDiscovered(const QString &newF)
             journal->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, undecidedList);
             emit newBigFolderDiscovered(newFolder);
         }
-        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);
+        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.");
 
         auto logger = Logger::instance();
         logger->postOptionalGuiLog(Theme::instance()->appNameGUI(), message);
index b44f5799b70bfbc7a173b3431365e7adcd07b9bb..57a618b006e1be4a1d7910033575d3dae02a7647 100644 (file)
@@ -290,7 +290,7 @@ private slots:
 
     void slotEmitFinishedDelayed();
 
-    void slotNewBigFolderDiscovered(const QString &);
+    void slotNewBigFolderDiscovered(const QString &, bool isExternal);
 
     void slotLogPropagationStart();
 
index 06b7aa0343f0e06533af154ab0412f9087e6529c..5a035a5922853ae0b4699fc351c0005ee3fed069 100644 (file)
      <property name="title">
       <string>Advanced</string>
      </property>
-     <layout class="QGridLayout" name="gridLayout">
-      <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="3" column="0" colspan="2">
-       <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>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_4">
+        <item>
+         <widget class="QPushButton" name="ignoredFilesButton">
+          <property name="text">
+           <string>Edit &amp;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>
       </item>
-      <item row="1" column="0" colspan="3">
+      <item>
        <layout class="QHBoxLayout" name="horizontalLayout_3">
         <item>
          <widget class="QCheckBox" name="newFolderLimitCheckBox">
         </item>
        </layout>
       </item>
-      <item row="3" 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>
-      <item row="0" column="0">
-       <widget class="QPushButton" name="ignoredFilesButton">
+      <item>
+       <widget class="QCheckBox" name="newExternalStorage">
         <property name="text">
-         <string>Edit &amp;Ignored Files</string>
+         <string>Ask for confirmation before synchronizing external storages</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="0" colspan="3">
-       <widget class="QCheckBox" name="newExternalStorage">
+      <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>Ask for confirmation before synchronizing external storages</string>
+         <string>S&amp;how crash reporter</string>
         </property>
        </widget>
       </item>
index 79b476d098cc5cd522384b2ca86472c96157da12..faa7c0b0703b4653296c9ade0d8cfeb258119226 100644 (file)
@@ -99,7 +99,7 @@ bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *
             return false;
         }
 
-        emit newBigFolder(path);
+        emit newBigFolder(path, true);
         return true;
     }
 
@@ -125,7 +125,7 @@ bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString& path, const char *
 
     if (result >= limit) {
         // we tell the UI there is a new folder
-        emit newBigFolder(path);
+        emit newBigFolder(path, false);
         return true;
     } else {
         // it is not too big, put it in the white list (so we will not do more query for the children)
index e521c1fabe2bb52ac85e0a777ec297cbc78cccc5..43c292e7ef7b4cd0c1c9309959e24bc2588878f7 100644 (file)
@@ -229,7 +229,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);
+    void newBigFolder(const QString &folder, bool isExternal);
 };
 
 }
index b6c347fe3d60cbe31e1d40875eea1f4c16f9f754..26ffecbe97befbe4311850d72077a718202a70f4 100644 (file)
@@ -835,8 +835,8 @@ void SyncEngine::startSync()
     connect(discoveryJob, SIGNAL(folderDiscovered(bool,QString)),
             this, SIGNAL(folderDiscovered(bool,QString)));
 
-    connect(discoveryJob, SIGNAL(newBigFolder(QString)),
-            this, SIGNAL(newBigFolder(QString)));
+    connect(discoveryJob, SIGNAL(newBigFolder(QString,bool)),
+            this, SIGNAL(newBigFolder(QString,bool)));
 
 
     // This is used for the DiscoveryJob to be able to request the main thread/
index 927c7ad5bf2a3f050c4f2aa69b446212f368a59f..f998790ba5cbbcef2a6beb368615a18e02390d22 100644 (file)
@@ -143,7 +143,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);
+    void newBigFolder(const QString &folder, bool isExternal);
 
     /** Emitted when propagation has problems with a locked file.
      *