Comparar commits

...

14 Commits

Autor SHA1 Mensagem Data
Markus Goetz c69cd514b8 Folder/Watcher: Fix up #5174 #5153
It was surprising to have a broken symlink return empty for
canonical path.
2016-09-15 12:39:37 +02:00
Markus Goetz b7809ded23 OS X: Try to fix tray menu not updating correctly #5158 (#5177)
I even had this issue long before 2.3 that submenus suddenly disappeared.
Now we refrain from updating while visible.
2016-09-13 14:34:22 +02:00
ckamm dfb121236c Excludes: Consider files in hidden folders excluded #5163 (#5173)
Previously, we only checked the hiddenness of the target file and
ignored the hiddenness of the containing folders. This lead to
undesired behavior when people synced their home folders and there
was a folder watcher notification for a non-hidden file in one of
the hidden folders.

I'm not fully sure why, but sometimes notifications for .foo/bar were
already ignored, but notifications for .foo/bar/car were not. This may
be because of how we set up the FolderWatchers on Linux.

The new behavior is to check all path components for hiddenness, up
until the base path (but excluding the base path, so using a hidden
folder as a sync folder will work).
2016-09-13 14:14:27 +02:00
ckamm f286493c90 Merge pull request #5174 from owncloud/fix5116_2
Better fix for #5116
2016-09-13 10:16:05 +02:00
Olivier Goffart c2cb729fee Folder: Cannonicalize the path
This is important because we compare the paths from the file system watcher if it
starts with this path.
Same in the SocketAPI where we need to use cannonical paths in the REGISTER_PATH command,
as the plugin themself will do this comparison.

Issue #5116
2016-09-12 16:56:59 +02:00
Olivier Goffart 904cd46f75 Revert "FolderWatcher: Act on relative paths #5116 (#5153)"
This is not sufficient as it is not working for the Socket API.
Next commit will fix it in another layer.

Also, not ignoring paths that are not inside the folder is wrong
as it might still happen if the name has a different casing

This reverts commit d5a481f132.
2016-09-12 16:05:55 +02:00
Klaas Freitag 2d110540ee Dolphin Plugin: Use the Application name for the socket path (#5172)
do not hardcode.

This should fix #5165
2016-09-12 14:12:33 +02:00
Markus Goetz d5a481f132 FolderWatcher: Act on relative paths #5116 (#5153) 2016-09-12 14:03:11 +02:00
Olivier Goffart 1d09f6b60f Allow to disable Shiboleth to build without QtWebkit (#5166) 2016-09-11 16:14:08 +02:00
Olivier Goffart 98268d102f ExcludeFiles: Fix when the folder casing is not the same in the settings and in the FS
If the folder has different case in the settings and in the FS, we should
not ignore all the files. This is important for the files system watcher.
2016-09-11 12:12:10 +02:00
Olivier Goffart 9e895a6ecc FolderStatusModel: Fix beginInsertRow/endInsertRow
We need to do the change between the begin and the end call so the selection
don't get broken
2016-09-11 12:12:10 +02:00
Markus Goetz 524220d090 Selective Sync: Fix request loop and show error in view (#5154)
I got into a situation where the model would endlessly request the directory
contents from the server because we did not notice yet that the server
is actually in maintenance mode while we were expanding the tree view when
changing the tab to the account or when just expanding it by clicking.
2016-09-06 11:11:03 +02:00
Christian Kamm af9c4d0e2f Recall: Copy instead of move recalled file #5150
That was an unintentional change in
2662203fb7

Also expand the test case to cover this.
2016-09-06 10:42:59 +02:00
Klaas Freitag c97d8aa8fd Show the rename target in the client log file. (#5149) 2016-09-05 13:26:49 +02:00
18 arquivos alterados com 151 adições e 29 exclusões
+7
Ver Arquivo
@@ -136,6 +136,13 @@ if(OWNCLOUD_RESTORE_RENAME)
add_definitions(-DOWNCLOUD_RESTORE_RENAME=1)
endif()
# Disable shibboleth.
# So the client can be built without QtWebKit
option(NO_SHIBBOLETH "Build without Shibboleth support. Allow to build the client without QtWebKit" OFF)
if(NO_SHIBBOLETH)
message("Compiling without shibboleth")
add_definitions(-DNO_SHIBBOLETH=1)
endif()
if(APPLE)
set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
+8 -2
Ver Arquivo
@@ -22,12 +22,18 @@ if( Qt5Core_FOUND )
find_package(Qt5Test REQUIRED)
endif()
if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5Widgets REQUIRED)
if(APPLE)
find_package(Qt5MacExtras REQUIRED)
endif(APPLE)
if(NOT NO_SHIBBOLETH)
find_package(Qt5WebKitWidgets)
find_package(Qt5WebKit)
if(NOT Qt5WebKitWidgets_FOUND)
message(FATAL_ERROR "Qt5WebKit required for Shibboleth. Use -DNO_SHIBBOLETH=1 to disable it.")
endif()
endif()
endif()
else( Qt5Core_FOUND )
+4
Ver Arquivo
@@ -64,6 +64,10 @@ csync();
assert( -e glob(localDir().'dir/file2_.sys.admin#recall#-*.dat' ) );
assert( -e glob(localDir().'dir/file3_.sys.admin#recall#-*.dat' ) );
# verify that the original files still exist
assert( -e glob(localDir().'dir/file2.dat' ) );
assert( -e glob(localDir().'dir/file3.dat' ) );
#Remove the recall file
unlink(localDir() . ".sys.admin#recall#");
@@ -21,6 +21,7 @@
#include <qcoreevent.h>
#include <QFile>
#include "ownclouddolphinpluginhelper.h"
#include "config.h"
OwncloudDolphinPluginHelper* OwncloudDolphinPluginHelper::instance()
{
@@ -67,7 +68,10 @@ void OwncloudDolphinPluginHelper::tryConnect()
return;
}
QString runtimeDir = QFile::decodeName(qgetenv("XDG_RUNTIME_DIR"));
QString socketPath = runtimeDir + QLatin1String("/ownCloud/socket");
runtimeDir.append( QChar('/'));
runtimeDir.append( QLatin1String(APPLICATION_SHORTNAME) );
const QString socketPath = runtimeDir + QLatin1String("/socket");
_socket.connectToServer(socketPath);
}
+13 -6
Ver Arquivo
@@ -94,22 +94,26 @@ set(client_SRCS
servernotificationhandler.cpp
creds/credentialsfactory.cpp
creds/httpcredentialsgui.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethuserjob.cpp
wizard/postfixlineedit.cpp
wizard/abstractcredswizardpage.cpp
wizard/owncloudadvancedsetuppage.cpp
wizard/owncloudconnectionmethoddialog.cpp
wizard/owncloudhttpcredspage.cpp
wizard/owncloudsetuppage.cpp
wizard/owncloudshibbolethcredspage.cpp
wizard/owncloudwizardcommon.cpp
wizard/owncloudwizard.cpp
wizard/owncloudwizardresultpage.cpp
../3rdparty/qjson/json.cpp
)
IF(NOT NO_SHIBBOLETH)
list(APPEND client_SRCS
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethuserjob.cpp
wizard/owncloudshibbolethcredspage.cpp
)
endif()
set(updater_SRCS
updater/ocupdater.cpp
@@ -232,6 +236,9 @@ set(ownCloud ${ownCloud_old})
if (WITH_DBUS)
set(ADDITIONAL_APP_MODULES DBus)
endif(WITH_DBUS)
if (NOT NO_SHIBBOLETH)
list(APPEND ADDITIONAL_APP_MODULES WebKitWidgets)
endif()
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
@@ -250,14 +257,14 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
# add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml WebKitWidgets Sql ${ADDITIONAL_APP_MODULES})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml Sql ${ADDITIONAL_APP_MODULES})
else()
# set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf.
set(MACOSX_BUNDLE_ICON_FILE "ownCloud.icns")
# we must add MACOSX_BUNDLE only if building a bundle
add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml WebKitWidgets Sql ${ADDITIONAL_APP_MODULES})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml Sql ${ADDITIONAL_APP_MODULES})
set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
install(FILES ${client_I18N} DESTINATION ${QM_DIR})
+4
Ver Arquivo
@@ -16,7 +16,9 @@
#include "creds/credentialsfactory.h"
#include "creds/httpcredentialsgui.h"
#include "creds/dummycredentials.h"
#ifndef NO_SHIBBOLETH
#include "creds/shibbolethcredentials.h"
#endif
namespace OCC
{
@@ -31,8 +33,10 @@ AbstractCredentials* create(const QString& type)
return new HttpCredentialsGui;
} else if (type == "dummy") {
return new DummyCredentials;
#ifndef NO_SHIBBOLETH
} else if (type == "shibboleth") {
return new ShibbolethCredentials;
#endif
} else {
qWarning("Unknown credentials type: %s", qPrintable(type));
return new DummyCredentials;
+9 -6
Ver Arquivo
@@ -123,6 +123,13 @@ Folder::~Folder()
void Folder::checkLocalPath()
{
const QFileInfo fi(_definition.localPath);
_canonicalLocalPath = fi.canonicalFilePath();
if (_canonicalLocalPath.isEmpty()) {
qDebug() << "Broken symlink:" << _definition.localPath;
_canonicalLocalPath = _definition.localPath;
} else if( !_canonicalLocalPath.endsWith('/') ) {
_canonicalLocalPath.append('/');
}
if( fi.isDir() && fi.isReadable() ) {
qDebug() << "Checked local path ok";
@@ -161,11 +168,7 @@ QString Folder::alias() const
QString Folder::path() const
{
QString p(_definition.localPath);
if( ! p.endsWith('/') ) {
p.append('/');
}
return p;
return _canonicalLocalPath;
}
QString Folder::shortGuiLocalPath() const
@@ -198,7 +201,7 @@ void Folder::setIgnoreHiddenFiles(bool ignore)
QString Folder::cleanPath()
{
QString cleanedPath = QDir::cleanPath(_definition.localPath);
QString cleanedPath = QDir::cleanPath(_canonicalLocalPath);
if(cleanedPath.length() == 3 && cleanedPath.endsWith(":/"))
cleanedPath.remove(2,1);
+1
Ver Arquivo
@@ -288,6 +288,7 @@ private:
AccountStatePtr _accountState;
FolderDefinition _definition;
QString _canonicalLocalPath; // As returned with QFileInfo:canonicalFilePath. Always ends with "/"
SyncResult _syncResult;
QScopedPointer<SyncEngine> _engine;
+15 -3
Ver Arquivo
@@ -164,7 +164,8 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
switch(role) {
case Qt::DisplayRole:
if (x->_hasError) {
return tr("Error while loading the list of folders from the server.");
return QVariant(tr("Error while loading the list of folders from the server.")
+ QString("\n") + x->_lastErrorString);
} else {
return tr("Fetching folder list from server...");
}
@@ -498,6 +499,10 @@ bool FolderStatusModel::canFetchMore(const QModelIndex& parent) const
auto info = infoForIndex(parent);
if (!info || info->_fetched || info->_fetching)
return false;
if (info->_hasError) {
// Keep showing the error to the user, it will be hidden when the account reconnects
return false;
}
return true;
}
@@ -548,6 +553,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
if (parentInfo->hasLabel()) {
beginRemoveRows(idx, 0 ,0);
parentInfo->_lastErrorString.clear();
parentInfo->_hasError = false;
parentInfo->_fetchingLabel = false;
endRemoveRows();
@@ -675,6 +681,9 @@ void FolderStatusModel::slotLscolFinishedWithError(QNetworkReply* r)
}
auto parentInfo = infoForIndex(idx);
if (parentInfo) {
qDebug() << r->errorString();
parentInfo->_lastErrorString = r->errorString();
if (r->error() == QNetworkReply::ContentNotFoundError) {
parentInfo->_fetched = true;
} else {
@@ -1067,11 +1076,14 @@ void FolderStatusModel::slotShowFetchProgress()
auto idx = it.key();
auto* info = infoForIndex(idx);
if (info && info->_fetching) {
if (!info->hasLabel()) {
bool add = !info->hasLabel();
if (add) {
beginInsertRows(idx, 0, 0);
endInsertRows();
}
info->_fetchingLabel = true;
if (add) {
endInsertRows();
}
}
it.remove();
}
+1
Ver Arquivo
@@ -63,6 +63,7 @@ public:
bool _fetched; // If we did the LSCOL for this folder already
bool _fetching; // Whether a LSCOL job is currently running
bool _hasError; // If the last fetching job ended in an error
QString _lastErrorString;
bool _fetchingLabel; // Whether a 'fetching in progress' label is shown.
bool _isUndecided; // undecided folders are the big folders that the user has not accepted yet
+36 -2
Ver Arquivo
@@ -56,6 +56,7 @@ ownCloudGui::ownCloudGui(Application *parent) :
_settingsDialog(new SettingsDialog(this)),
#endif
_logBrowser(0),
_contextMenuVisible(false),
_recentActionsMenu(0),
_qdbusmenuWorkaround(false),
_folderOpenActionMapper(new QSignalMapper(this)),
@@ -405,6 +406,21 @@ static bool minimalTrayMenu()
return !var.isEmpty();
}
void ownCloudGui::slotContextMenuAboutToShow()
{
// For some reason on OS X _contextMenu->isVisible returns always false
qDebug() << "";
_contextMenuVisible = true;
}
void ownCloudGui::slotContextMenuAboutToHide()
{
// For some reason on OS X _contextMenu->isVisible returns always false
qDebug() << "";
_contextMenuVisible = false;
}
void ownCloudGui::setupContextMenu()
{
// The tray menu is surprisingly problematic. Being able to switch to
@@ -455,7 +471,14 @@ void ownCloudGui::setupContextMenu()
// Update the context menu whenever we're about to show it
// to the user.
#ifdef Q_OS_MAC
// https://bugreports.qt.io/browse/QTBUG-54633
#else
connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(setupContextMenu()));
#endif
connect(_contextMenu.data(), SIGNAL(aboutToShow()), SLOT(slotContextMenuAboutToShow()));
connect(_contextMenu.data(), SIGNAL(aboutToHide()), SLOT(slotContextMenuAboutToHide()));
_recentActionsMenu = new QMenu(tr("Recent Changes"), _contextMenu.data());
// this must be called only once after creating the context menu, or
@@ -560,8 +583,15 @@ void ownCloudGui::setupContextMenu()
void ownCloudGui::setupContextMenuIfVisible()
{
if (_contextMenu && _contextMenu->isVisible())
#ifdef Q_OS_MAC
// https://bugreports.qt.io/browse/QTBUG-54845
if (!_contextMenuVisible) {
setupContextMenu();
}
#else
if (_contextMenuVisible)
setupContextMenu();
#endif
}
void ownCloudGui::slotShowTrayMessage(const QString &title, const QString &msg)
@@ -724,9 +754,13 @@ void ownCloudGui::slotUpdateProgress(const QString &folder, const ProgressInfo&
// Update the "Recent" menu if the context menu is being shown,
// otherwise it'll be updated later, when the context menu is opened.
if (_contextMenu && _contextMenu->isVisible()) {
#ifdef Q_OS_MAC
// https://bugreports.qt.io/browse/QTBUG-54845
#else
if (_contextMenuVisible) {
slotRebuildRecentMenus();
}
#endif
}
if (progress.isUpdatingEstimates()
+4
Ver Arquivo
@@ -58,6 +58,8 @@ signals:
public slots:
void setupContextMenu();
void setupContextMenuIfVisible();
void slotContextMenuAboutToShow();
void slotContextMenuAboutToHide();
void slotComputeOverallSyncStatus();
void slotShowTrayMessage(const QString &title, const QString &msg);
void slotShowOptionalTrayMessage(const QString &title, const QString &msg);
@@ -102,6 +104,8 @@ private:
QPointer<LogBrowser>_logBrowser;
// tray's menu
QScopedPointer<QMenu> _contextMenu;
bool _contextMenuVisible;
QMenu *_recentActionsMenu;
QVector<QMenu*> _accountMenus;
bool _qdbusmenuWorkaround;
+4 -1
Ver Arquivo
@@ -539,12 +539,15 @@ bool DetermineAuthTypeJob::finished()
setupConnections(reply());
return false; // don't discard
} else {
#ifndef NO_SHIBBOLETH
QRegExp shibbolethyWords("SAML|wayf");
shibbolethyWords.setCaseSensitivity(Qt::CaseInsensitive);
if (redirection.toString().contains(shibbolethyWords)) {
emit authType(WizardCommon::Shibboleth);
} else {
} else
#endif
{
// TODO: Send an error.
// eh?
emit authType(WizardCommon::HttpCreds);
+5 -1
Ver Arquivo
@@ -145,7 +145,11 @@ void SyncRunFileLog::logItem( const SyncFileItem& item )
const QChar L = QLatin1Char('|');
_out << ts << L;
_out << QString::number(item._requestDuration) << L;
_out << item._file << L;
if( item.log._instruction != CSYNC_INSTRUCTION_RENAME ) {
_out << item._file << L;
} else {
_out << item._file << QLatin1String(" -> ") << item._renameTarget << L;
}
_out << instructionToStr( item.log._instruction ) << L;
_out << directionToStr( item._direction ) << L;
_out << QString::number(item.log._modtime) << L;
+14 -1
Ver Arquivo
@@ -20,7 +20,9 @@
#include "wizard/owncloudwizard.h"
#include "wizard/owncloudsetuppage.h"
#include "wizard/owncloudhttpcredspage.h"
#ifndef NO_SHIBBOLETH
#include "wizard/owncloudshibbolethcredspage.h"
#endif
#include "wizard/owncloudadvancedsetuppage.h"
#include "wizard/owncloudwizardresultpage.h"
@@ -39,7 +41,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
_account(0),
_setupPage(new OwncloudSetupPage(this)),
_httpCredsPage(new OwncloudHttpCredsPage(this)),
#ifndef NO_SHIBBOLETH
_shibbolethCredsPage(new OwncloudShibbolethCredsPage),
#endif
_advancedSetupPage(new OwncloudAdvancedSetupPage),
_resultPage(new OwncloudWizardResultPage),
_credentialsPage(0),
@@ -48,7 +52,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setPage(WizardCommon::Page_ServerSetup, _setupPage);
setPage(WizardCommon::Page_HttpCreds, _httpCredsPage);
#ifndef NO_SHIBBOLETH
setPage(WizardCommon::Page_ShibbolethCreds, _shibbolethCredsPage);
#endif
setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage);
setPage(WizardCommon::Page_Result, _resultPage);
@@ -61,7 +67,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int)));
connect( _setupPage, SIGNAL(determineAuthType(QString)), SIGNAL(determineAuthType(QString)));
connect( _httpCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString)));
#ifndef NO_SHIBBOLETH
connect( _shibbolethCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString)));
#endif
connect( _advancedSetupPage, SIGNAL(createLocalAndRemoteFolders(QString, QString)),
SIGNAL(createLocalAndRemoteFolders(QString, QString)));
connect(this, SIGNAL(customButtonClicked(int)), this, SIGNAL(skipFolderConfiguration()));
@@ -128,9 +136,11 @@ void OwncloudWizard::successfulStep()
_httpCredsPage->setConnected();
break;
#ifndef NO_SHIBBOLETH
case WizardCommon::Page_ShibbolethCreds:
_shibbolethCredsPage->setConnected();
break;
#endif
case WizardCommon::Page_AdvancedSetup:
_advancedSetupPage->directoriesCreated();
@@ -148,9 +158,12 @@ void OwncloudWizard::successfulStep()
void OwncloudWizard::setAuthType(WizardCommon::AuthType type)
{
_setupPage->setAuthType(type);
#ifndef NO_SHIBBOLETH
if (type == WizardCommon::Shibboleth) {
_credentialsPage = _shibbolethCredsPage;
} else {
} else
#endif
{
_credentialsPage = _httpCredsPage;
}
next();
+4
Ver Arquivo
@@ -25,7 +25,9 @@ namespace OCC {
class OwncloudSetupPage;
class OwncloudHttpCredsPage;
#ifndef NO_SHIBBOLETH
class OwncloudShibbolethCredsPage;
#endif
class OwncloudAdvancedSetupPage;
class OwncloudWizardResultPage;
class AbstractCredentials;
@@ -88,7 +90,9 @@ private:
AccountPtr _account;
OwncloudSetupPage* _setupPage;
OwncloudHttpCredsPage* _httpCredsPage;
#ifndef NO_SHIBBOLETH
OwncloudShibbolethCredsPage* _shibbolethCredsPage;
#endif
OwncloudAdvancedSetupPage* _advancedSetupPage;
OwncloudWizardResultPage* _resultPage;
AbstractCredentialsWizardPage* _credentialsPage;
+14 -4
Ver Arquivo
@@ -12,6 +12,7 @@
*/
#include "excludedfiles.h"
#include "utility.h"
#include <QFileInfo>
@@ -70,18 +71,27 @@ bool ExcludedFiles::isExcluded(
const QString& basePath,
bool excludeHidden) const
{
if (!filePath.startsWith(basePath)) {
if (!filePath.startsWith(basePath, Utility::fsCasePreserving() ? Qt::CaseInsensitive : Qt::CaseSensitive)) {
// Mark paths we're not responsible for as excluded...
return true;
}
QFileInfo fi(filePath);
if( excludeHidden ) {
if( fi.isHidden() || fi.fileName().startsWith(QLatin1Char('.')) ) {
return true;
QString path = filePath;
// Check all path subcomponents, but to *not* check the base path:
// We do want to be able to sync with a hidden folder as the target.
while (path.size() > basePath.size()) {
QFileInfo fi(path);
if( fi.isHidden() || fi.fileName().startsWith(QLatin1Char('.')) ) {
return true;
}
// Get the parent path
path = fi.absolutePath();
}
}
QFileInfo fi(filePath);
csync_ftw_type_e type = CSYNC_FTW_TYPE_FILE;
if (fi.isDir()) {
type = CSYNC_FTW_TYPE_DIR;
+3 -2
Ver Arquivo
@@ -637,8 +637,9 @@ static void handleRecallFile(const QString &fn)
QString rpath = makeRecallFileName(fpath);
qDebug() << "Copy recall file: " << fpath << " -> " << rpath;
QString error;
FileSystem::uncheckedRenameReplace(fpath, rpath, &error);
// Remove the target first, QFile::copy will not overwrite it.
FileSystem::remove(rpath);
QFile::copy(fpath, rpath);
}
}