Merge remote-tracking branch 'origin/2.4'

Conflicts:
	shell_integration/nautilus/syncstate.py
This commit is contained in:
Olivier Goffart 2018-01-23 14:08:15 +01:00
commit 72b9beb79c
7 changed files with 47 additions and 18 deletions

View file

@ -182,6 +182,18 @@ X-GNOME-Autostart-Delay=3
# Translations
# Translations
# Translations
# Translations
# Translations
# Translations
Comment[oc]=@APPLICATION_NAME@ sincronizacion del client
GenericName[oc]=Dorsièr de Sincronizacion

View file

@ -15,8 +15,13 @@
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
import sys
python3 = sys.version_info[0] >= 3
import os
import urllib
if python3:
import urllib.parse
import socket
import tempfile
import time
@ -31,11 +36,11 @@ appname = 'ownCloud'
print("Initializing "+appname+"-client-nautilus extension")
def get_local_path(url):
if url[0:7] == 'file://':
url = url[7:]
return urllib.unquote(url)
unquote = urllib.parse.unquote if python3 else urllib.unquote
return unquote(url)
def get_runtime_dir():
"""Returns the value of $XDG_RUNTIME_DIR, a directory path.
@ -57,7 +62,7 @@ class SocketConnect(GObject.GObject):
self._watch_id = 0
self._sock = None
self._listeners = [self._update_registered_paths, self._get_version]
self._remainder = ''
self._remainder = ''.encode()
self.protocolVersion = '1.0'
self.nautilusVFSFile_table = {} # not needed in this object actually but shared
# all over the other objects.
@ -76,7 +81,7 @@ class SocketConnect(GObject.GObject):
# print("Server command: " + cmd)
if self.connected:
try:
self._sock.send(cmd)
self._sock.send(cmd.encode())
except:
print("Sending failed.")
self.reconnect()
@ -126,12 +131,12 @@ class SocketConnect(GObject.GObject):
# Parses response lines out of collected data, returns list of strings
def get_available_responses(self):
end = self._remainder.rfind('\n')
end = self._remainder.rfind('\n'.encode())
if end == -1:
return []
data = self._remainder[:end]
self._remainder = self._remainder[end+1:]
return data.split('\n')
return data.decode().split('\n')
# Notify is the raw answer from the socket
def _handle_notify(self, source, condition):

View file

@ -217,7 +217,7 @@ void IssuesWidget::slotProgressInfo(const QString &folder, const ProgressInfo &p
void IssuesWidget::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
{
if (!item->hasErrorStatus())
if (!item->showInIssuesTab())
return;
QTreeWidgetItem *line = ProtocolItem::create(folder, *item);
if (!line)

View file

@ -308,7 +308,7 @@ void ProtocolWidget::slotOpenFile(QTreeWidgetItem *item, int)
void ProtocolWidget::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
{
if (item->hasErrorStatus())
if (!item->showInProtocolTab())
return;
QTreeWidgetItem *line = ProtocolItem::create(folder, *item);
if (line) {

View file

@ -224,11 +224,10 @@ void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shar
// Connect all shares signals to gui slots
connect(share.data(), &Share::serverError, this, &ShareLinkWidget::slotServerError);
connect(share.data(), &Share::shareDeleted, this, &ShareLinkWidget::slotDeleteShareFetched);
connect(share.data(), SIGNAL(expireDateSet()), SLOT(slotExpireSet()));
connect(share.data(), SIGNAL(publicUploadSet()), SLOT(slotPermissionsSet()));
connect(share.data(), SIGNAL(passwordSet()), SLOT(slotPasswordSet()));
connect(share.data(), SIGNAL(passwordSetError(int, QString)), SLOT(slotPasswordSetError(int, QString)));
connect(share.data(), &Share::permissionsSet, this, &ShareLinkWidget::slotPermissionsSet);
connect(linkShare.data(), &LinkShare::expireDateSet, this, &ShareLinkWidget::slotExpireSet);
connect(linkShare.data(), &LinkShare::passwordSet, this, &ShareLinkWidget::slotPasswordSet);
connect(linkShare.data(), &LinkShare::passwordSetError, this, &ShareLinkWidget::slotPasswordSetError);
// Build the table row
auto row = table->rowCount();

View file

@ -177,7 +177,7 @@ void Logger::setLogFlush(bool flush)
void Logger::setLogDebug(bool debug)
{
QLoggingCategory::setFilterRules(debug ? QStringLiteral("qt.*=true\n*.debug=true") : QString());
QLoggingCategory::setFilterRules(debug ? QStringLiteral("sync.*.debug=true\ngui.*.debug=true") : QString());
_logDebug = debug;
}

View file

@ -171,20 +171,33 @@ public:
/**
* True if the item had any kind of error.
*
* Used for deciding whether an item belongs to the protocol or the
* issues list on the activity page and for checking whether an
* item should be announced in the notification message.
*/
bool hasErrorStatus() const
{
return _status == SyncFileItem::SoftError
|| _status == SyncFileItem::NormalError
|| _status == SyncFileItem::FatalError
|| _status == SyncFileItem::Conflict
|| !_errorString.isEmpty();
}
/**
* Whether this item should appear on the issues tab.
*/
bool showInIssuesTab() const
{
return hasErrorStatus() || _status == SyncFileItem::Conflict;
}
/**
* Whether this item should appear on the protocol tab.
*/
bool showInProtocolTab() const
{
return !showInIssuesTab()
// Don't show conflicts that were resolved as "not a conflict after all"
&& !(_instruction == CSYNC_INSTRUCTION_CONFLICT && _status == SyncFileItem::Success);
}
// Variables useful for everybody
QString _file;
QString _renameTarget;