[Pkg-owncloud-commits] [owncloud-client] 88/175: Recall feature: Fix some style issues
Sandro Knauß
hefee-guest at moszumanska.debian.org
Sat Aug 8 10:36:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 9a02a0f3a876c4b02656c608343d1fca60e971ed
Author: Olivier Goffart <ogoffart at woboq.com>
Date: Fri May 15 15:45:50 2015 +0200
Recall feature: Fix some style issues
---
src/libsync/propagatedownload.cpp | 36 +++++++++---------------------------
src/libsync/propagateupload.cpp | 3 +--
2 files changed, 10 insertions(+), 29 deletions(-)
diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index 9b9c258..256a170 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -507,8 +507,8 @@ QString makeConflictFileName(const QString &fn, const QDateTime &dt)
return conflictFileName;
}
-QStringList parseRecallFile(QString fn) {
-
+static QStringList parseRecallFile(const QString &fn)
+{
qDebug() << "parsingRecallFile: " << fn;
QStringList result;
@@ -521,19 +521,14 @@ QStringList parseRecallFile(QString fn) {
while (!file.atEnd()) {
QByteArray line = file.readLine();
-
line.chop(1); // remove trailing \n
-
qDebug() << "recall item: " << line;
-
result.append(line);
}
-
return result;
-
}
-QString makeRecallFileName(const QString &fn)
+static QString makeRecallFileName(const QString &fn)
{
QString recallFileName(fn);
// Add _recall-XXXX before the extention.
@@ -544,13 +539,7 @@ QString makeRecallFileName(const QString &fn)
}
QString timeString = QDateTime::currentDateTime().toString("yyyyMMdd-hhmmss");
-
- // Additional marker
- QByteArray recallFileUserName = qgetenv("CSYNC_RECALL_FILE_USERNAME");
- if (recallFileUserName.isEmpty())
- recallFileName.insert(dotLocation, "_.sys.admin#recall#-" + timeString);
- else
- recallFileName.insert(dotLocation, "_.sys.admin#recall#_" + QString::fromUtf8(recallFileUserName) + "-" + timeString);
+ recallFileName.insert(dotLocation, "_.sys.admin#recall#-" + timeString);
return recallFileName;
}
@@ -640,31 +629,24 @@ void PropagateDownloadFileQNAM::downloadFinished()
_propagator->_journal->commit("download file start2");
done(isConflict ? SyncFileItem::Conflict : SyncFileItem::Success);
-
-
// handle the special recall file
- QFileInfo existingFile(fn);
- if(existingFile.fileName()==".sys.admin#recall#")
- {
- //FileSystem::setFileHidden(existingFile.fileName(), true);
+ if(_item._file == QLatin1String(".sys.admin#recall#")) {
+ FileSystem::setFileHidden(fn, true);
+ QFileInfo existingFile(fn);
QDir thisDir = existingFile.dir();
QStringList recall_files = parseRecallFile(existingFile.filePath());
- for (int i = 0; i < recall_files.size(); ++i)
- {
+ for (int i = 0; i < recall_files.size(); ++i) {
QString fpath = thisDir.filePath(recall_files.at(i));
- QString rpath = thisDir.filePath(makeRecallFileName(recall_files.at(i)));
+ QString rpath = makeRecallFileName(fpath);
// if previously recalled file exists then remove it (copy will not overwrite it)
QFile(rpath).remove();
-
qDebug() << "Copy recall file: " << fpath << " -> " << rpath;
-
QFile::copy(fpath,rpath);
}
-
}
}
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index dfefd52..980c361 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -393,8 +393,7 @@ void PropagateUploadFileQNAM::startNextChunk()
headers["Content-Type"] = "application/octet-stream";
headers["X-OC-Mtime"] = QByteArray::number(qint64(_item._modtime));
- if(_item._file.contains(".sys.admin#recall#"))
- {
+ if(_item._file.contains(".sys.admin#recall#")) {
// This is a file recall triggered by the admin. Note: the
// recall list file created by the admin and downloaded by the
// client (.sys.admin#recall#) also falls into this category
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list