Comparar commits

...

20 Commits

Autor SHA1 Mensagem Data
Roeland Jago Douma b6dd13f353 First step in getting share by email to work 2016-06-01 15:02:13 +02:00
Jenkins for ownCloud e031f7d090 [tx-robot] updated from transifex 2016-06-01 01:18:50 -04:00
Stephen Colebrook d4b72132d6 Search results are filtered by server. Don't filter a second time. Also allows searching on attributes other than displayname in ldap configurations. Search results match web and mobile apps. (#4902) 2016-05-31 09:45:38 +02:00
Daniel Molkentin 763016bd8f Merge pull request #4916 from mwleeds/patch-1
Fix typo in folder.cpp
2016-05-27 18:13:05 +02:00
Matthew Leeds 7f0cc5b699 Fix typo in folder.cpp 2016-05-27 11:13:18 -04:00
Jenkins for ownCloud d3a93cbaeb [tx-robot] updated from transifex 2016-05-27 01:15:50 -04:00
Daniel Molkentin 85d3c7a263 Merge remote-tracking branch 'origin/2.2' 2016-05-26 10:19:50 +02:00
Olivier Goffart 159535fe90 Merge branch '2.2' 2016-05-25 16:30:17 +02:00
Markus Goetz 088a294fac Update issue_template.md
Use 2.2 link
2016-05-25 11:33:10 +02:00
Jenkins for ownCloud 813bc15a78 [tx-robot] updated from transifex 2016-05-22 01:15:47 -04:00
ckamm 567fe87e98 Use natural sorting for filenames if available #4859 (#4864) 2016-05-19 15:36:46 +02:00
Christian Kamm a1ba23eea9 Activity: When a new notification arrives, switch to that tab #4805 2016-05-19 14:13:07 +02:00
Olivier Goffart 194db066b6 Merge remote-tracking branch 'origin/2.2' 2016-05-17 10:04:31 +02:00
Jocelyn Turcotte 129c17651a Revert "Overlay icon fixes (#4765)"
The pull request should have been done against the 2.2 branch, and
the branch would better be merged instead of squashed to keep the
history easier to lookup.

This reverts commit 0469236d80.
2016-05-03 12:59:17 +02:00
Jocelyn Turcotte 0469236d80 Overlay icon fixes (#4765)
* Fix the sync status push for parent directories #4682

As before, we rely on metadata-update SyncFileItem entries for parent
directories to notify us that a directory contains files to propagate,
and to know when all children were propagated through its itemCompleted
signal.

Those metadata SyncFileItems however have a None direction and we need
to add a explicit directory check to show them as Sync.
This fix also handles new files as well as existing ones, so no need
to keep a separate logic for new files.

* Fix the root item sync status #4682

Make sure that we push the new status when the status of the SyncEngine
changed. SyncEngine::started comes a bit late, only when the propagation
starts, although it's better in this case since child folders will
only switch to Sync in aboutToPropagate.

Also fix an issue with SyncEngine::findSyncItem when using an empty
fileName; this would match and return the wrong item, even though
not currently happening with the code since fileStatus won't call
it with an empty fileName anymore.

* Simplify the root status logic

Go through fileStatus like other cases to make sure that all use
cases go through the same code path. This also makes sure to use
lookupProblem which will use lower_bound which is more efficient
for larger sets of sync problems.

This also fixes the issue with lookupProblem that prevented it to
properly match an empty pathToMatch, caused by the fact that the
problem map contains relative paths not starting with a slash.

* Avoid a SyncFileStatusTracker private overload with the same name

Having an overload as a private function in the same class makes the
code harder to follow. Rename the private fileStatus to syncFileItemStatus.

* [osx] Fix missing overlay icons on client startup

Since the statuses are cached and that we can't invalidate the cache,
sending NOP would need to be overwritten by the default OK status
once the client successfully connected. But instead of remembering
which files we NOPed, rather wait until we are ready to sync before
sending the REGISTER_PATH message to the socket API client. It will
also prevent the client from sending unnecessary RETRIEVE_FILE_STATUS
requests.

Also remove AccountState::canSync, since it does the same as
isConnected and syncing is not an account responsibility.
2016-05-02 16:33:17 +02:00
Olivier Goffart 93e0d52dd3 Merge pull request #4769 from orion1024/curl-check-in-perl-tests
Adding CURL check in t6.pl
2016-04-30 14:25:21 +02:00
orion1024 9f3e576348 Adding CURL check in t6.pl
Aborts immediately if CURL not found, to avoid misleading errors later.
2016-04-30 11:44:16 +02:00
Olivier Goffart 5479aaeb5b Merge remote-tracking branch 'origin/2.2' 2016-04-28 16:38:46 +02:00
Christian Kamm 8dc178a9f3 Share link: Consistent order of options owncloud/core#24122 2016-04-26 07:45:41 +02:00
Klaas Freitag 35d4b96339 Set base version to 2.3.0. For 2.2, please use the branch 2.2 2016-04-25 14:15:17 +02:00
23 arquivos alterados com 254 adições e 17 exclusões
+2 -2
Ver Arquivo
@@ -1,6 +1,6 @@
set( MIRALL_VERSION_MAJOR 2 )
set( MIRALL_VERSION_MINOR 2 )
set( MIRALL_VERSION_PATCH 1 )
set( MIRALL_VERSION_MINOR 3 )
set( MIRALL_VERSION_PATCH 0 )
set( MIRALL_VERSION_YEAR 2016 )
set( MIRALL_SOVERSION 0 )
+1 -1
Ver Arquivo
@@ -30,7 +30,7 @@ StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_Desc "Z
StrCpy $UNINSTALLER_FILE_Detail "Zapisuji odinstal tor"
StrCpy $UNINSTALLER_REGISTRY_Detail "Zapisuji instal tor do registr…"
StrCpy $UNINSTALLER_FINISHED_Detail "DokonŸeno"
StrCpy $UNINSTALL_MESSAGEBOX "Nezd  se, §e ${APPLICATION_NAME} je nainstalov na ve slo§ce '$INSTDIR'.$\n$\nChcete pokraŸovat (nedoporuŸuje se)?"
StrCpy $UNINSTALL_MESSAGEBOX "Nezd  se, §e ${APPLICATION_NAME} je nainstalov na v adres ýi '$INSTDIR'.$\n$\nChcete pokraŸovat (nedoporuŸuje se)?"
StrCpy $UNINSTALL_ABORT "Odinstalace zruçena u§ivatelem"
StrCpy $INIT_NO_QUICK_LAUNCH "Z stupce rychlho spuçtØn¡ (nen¡ k dispozici)"
StrCpy $INIT_NO_DESKTOP "Z stupce na ploçe (pýep¡çe existuj¡c¡)"
+4 -4
Ver Arquivo
@@ -3,12 +3,12 @@ StrCpy $MUI_FINISHPAGE_SHOWREADME_TEXT_STRING "Mostrar notas de lançamento"
StrCpy $ConfirmEndProcess_MESSAGEBOX_TEXT "Existem ${APPLICATION_EXECUTABLE} processo(s) em execução que precisa(m) de ser interrompido(s).$\nDeseja que o instalador o(s) termine automaticamente?"
StrCpy $ConfirmEndProcess_KILLING_PROCESSES_TEXT "A terminar os processos ${APPLICATION_EXECUTABLE}."
StrCpy $ConfirmEndProcess_KILL_NOT_FOUND_TEXT "Não foi encontrado o processo a terminar!"
StrCpy $PageReinstall_NEW_Field_1 "Uma versão antiga de ${APPLICATION_NAME} está instalada no sistema. É recomendado que você desinstale a versão atual antes de instalar a mais recente. Selecione a operação que deseja executar e clique em $\"Avançar$\" para continuar."
StrCpy $PageReinstall_NEW_Field_1 "Uma versão antiga de ${APPLICATION_NAME} está instalada no sistema. É recomendado que desinstale a versão atual antes de instalar a mais recente. Selecione a operação que deseja executar e clique em $\"Avançar$\" para continuar."
StrCpy $PageReinstall_NEW_Field_2 "Desinstalar antes de instalar"
StrCpy $PageReinstall_NEW_Field_3 "Não desinstale"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Já instalado"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Escolha como pretende instalar ${APPLICATION_NAME}."
StrCpy $PageReinstall_OLD_Field_1 "Uma versão mais recente do ${APPLICATION_NAME} já está instalada! Não é recomendada a instalação de uma versão mais antiga. Se realmente deseja instalar esta versão, aconselha-se a desinstalação da versão atual primeiro. Selecione a operação que deseja executar e clique em Avançar para continuar."
StrCpy $PageReinstall_OLD_Field_1 "Uma versão mais recente da aplicação ${APPLICATION_NAME} já está instalada! Não é recomendada a instalação de uma versão mais antiga. Se realmente deseja instalar esta versão, aconselha-se a desinstalação da versão atual primeiro. Selecione a operação que deseja executar e clique em Avançar para continuar."
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} já está instalada.$\nSelecione a operação que deseja realizar e clique em 'Seguinte' para continuar."
StrCpy $PageReinstall_SAME_Field_2 "Adicionar/Reinstalar Componentes"
StrCpy $PageReinstall_SAME_Field_3 "Desinstalar ${APPLICATION_NAME}"
@@ -25,12 +25,12 @@ StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_SECTION "Atalho de início rápido"
StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_DetailPrint "A criar atalho de início rápido"
StrCpy $OPTION_SECTION_SC_APPLICATION_Desc "O essencial de ${APPLICATION_NAME}."
StrCpy $OPTION_SECTION_SC_START_MENU_Desc "Atalho de ${APPLICATION_NAME}."
StrCpy $OPTION_SECTION_SC_DESKTOP_Desc "Atalho no ambiente de trabalho de ${APPLICATION_NAME}."
StrCpy $OPTION_SECTION_SC_DESKTOP_Desc "Atalho do ambiente de trabalho para ${APPLICATION_NAME}."
StrCpy $OPTION_SECTION_SC_QUICK_LAUNCH_Desc "Atalho de início rápido de ${APPLICATION_NAME}."
StrCpy $UNINSTALLER_FILE_Detail "A escrever o Desinstalador"
StrCpy $UNINSTALLER_REGISTRY_Detail "A escrever chaves de registo do instalador"
StrCpy $UNINSTALLER_FINISHED_Detail "Terminado"
StrCpy $UNINSTALL_MESSAGEBOX "Não parece que ${APPLICATION_NAME} esteja instalado no diretório '$INSTDIR'.$\n$\nContinuar na mesma (não recomendado)?"
StrCpy $UNINSTALL_MESSAGEBOX "Não parece que a aplicação ${APPLICATION_NAME} esteja instalada no diretório '$INSTDIR'.$\n$\nContinuar na mesma (não recomendado)?"
StrCpy $UNINSTALL_ABORT "Desinstalação cancelada pelo utilizador"
StrCpy $INIT_NO_QUICK_LAUNCH "Atalho de Início Rápido (N/A)"
StrCpy $INIT_NO_DESKTOP "Atalho do Ambiente de Trabalho (sobrepõe o existente)"
+1 -1
Ver Arquivo
@@ -9,6 +9,7 @@ StrCpy $PageReinstall_NEW_Field_3 "Avinstallera inte"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_TITLE "Redan installerad"
StrCpy $PageReinstall_NEW_MUI_HEADER_TEXT_SUBTITLE "Välj hur du vill installera ${APPLICATION_NAME}."
StrCpy $PageReinstall_OLD_Field_1 "En nyare version av ${APPLICATION_NAME} är redan installerad! Det rekommenderas inte att du installerar en äldre version. Om du verkligen vill installera denna äldre versionen, är det bättre att du avinstallerar den nuvarande versionen först. Välj den åtgärd du vill utföra och klicka Nästa för att fortsätta."
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} är redan installerad.$\n$\nVälj den åtgärd du vill utföra och klicka på Nästa för att fortsätta."
StrCpy $PageReinstall_SAME_Field_2 "Lägg till/Ominstallera komponenter"
StrCpy $PageReinstall_SAME_Field_3 "Avinstallera ${APPLICATION_NAME}"
StrCpy $UNINSTALLER_APPDATA_TITLE "Avinstallera ${APPLICATION_NAME}"
@@ -40,4 +41,3 @@ StrCpy $UAC_UNINSTALLER_REQUIRE_ADMIN "Detta avinstallationsprogram kräver adm
StrCpy $UAC_ERROR_LOGON_SERVICE "Login-service körs inte, avbryter!"
StrCpy $INIT_UNINSTALLER_RUNNING "Avinstallationsprogrammet körs redan."
StrCpy $SectionGroup_Shortcuts "Genvägar"
StrCpy $PageReinstall_SAME_Field_1 "${APPLICATION_NAME} ${VERSION} is already installed.$\r$\nSelect the operation you want to perform and click Next to continue."
+7
Ver Arquivo
@@ -31,6 +31,13 @@ use strict;
print "Hello, this is t6, a tester for csync with ownCloud.\n";
# Checking CURL is installed to avoid misleading errors later...
system(("curl", "--help", ">", "/dev/null"));
if ($? != 0) {
print "CURL is needed for this script, aborting with error\n";
exit 1;
}
initTesting();
sub createPostUpdateScript($)
+1 -1
Ver Arquivo
@@ -40,7 +40,7 @@ logs.
1. Output of `owncloud --logwindow` or `owncloud --logfile log.txt`
(On Windows using `cmd.exe`, you might need to first `cd` into the ownCloud directory)
(See also http://doc.owncloud.org/desktop/1.8/troubleshooting.html#client-logfile )
(See also http://doc.owncloud.org/desktop/2.2/troubleshooting.html#client-logfile )
2. Web server error log:
+1
Ver Arquivo
@@ -72,6 +72,7 @@ set(client_SRCS
settingsdialog.cpp
share.cpp
sharedialog.cpp
shareemailwidget.cpp
sharelinkwidget.cpp
shareusergroupwidget.cpp
sharee.cpp
+16
Ver Arquivo
@@ -248,6 +248,9 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
QHash<QString, int> accNotified;
QString listAccountName;
// Whether a new notification widget was added to the notificationLayout.
bool newNotificationShown = false;
foreach( auto activity, list ) {
if( _blacklistedNotifications.contains(activity)) {
qDebug() << Q_FUNC_INFO << "Activity in blacklist, skip";
@@ -271,6 +274,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
_ui->_notifyScroll->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
#endif
_widgetForNotifId[activity.ident()] = widget;
newNotificationShown = true;
}
widget->setActivity( activity );
@@ -365,6 +369,10 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
const QString log = tr("%1 Notifications - Action Required").arg(Theme::instance()->appNameGUI());
emit guiLog( log, msg);
}
if (newNotificationShown) {
emit newNotification();
}
}
void ActivityWidget::slotSendNotificationRequest(const QString& accountName, const QString& link, const QByteArray& verb)
@@ -517,6 +525,7 @@ ActivitySettings::ActivitySettings(QWidget *parent)
connect(_activityWidget, SIGNAL(copyToClipboard()), this, SLOT(slotCopyToClipboard()));
connect(_activityWidget, SIGNAL(hideActivityTab(bool)), this, SLOT(setActivityTabHidden(bool)));
connect(_activityWidget, SIGNAL(guiLog(QString,QString)), this, SIGNAL(guiLog(QString,QString)));
connect(_activityWidget, SIGNAL(newNotification()), SLOT(slotShowActivityTab()));
_protocolWidget = new ProtocolWidget(this);
_tab->insertTab(1, _protocolWidget, Theme::instance()->syncStateIcon(SyncResult::Success), tr("Sync Protocol"));
@@ -582,6 +591,13 @@ void ActivitySettings::slotShowIssueItemCount(int cnt)
_tab->setTabText(_syncIssueTabId, cntText);
}
void ActivitySettings::slotShowActivityTab()
{
if (_activityTabId != -1) {
_tab->setCurrentIndex(_activityTabId);
}
}
void ActivitySettings::slotCopyToClipboard()
{
QString text;
+2 -1
Ver Arquivo
@@ -81,7 +81,7 @@ signals:
void copyToClipboard();
void rowsInserted();
void hideActivityTab(bool);
void newNotificationList(const ActivityList& list);
void newNotification();
private slots:
void slotBuildNotificationDisplay(const ActivityList& list);
@@ -143,6 +143,7 @@ private slots:
void setActivityTabHidden(bool hidden);
void slotRegularNotificationCheck();
void slotShowIssueItemCount(int cnt);
void slotShowActivityTab();
signals:
void guiLog(const QString&, const QString&);
+2
Ver Arquivo
@@ -179,6 +179,8 @@ Application::Application(int &argc, char **argv) :
connect(FolderMan::instance()->socketApi(), SIGNAL(shareCommandReceived(QString, QString, bool)),
_gui, SLOT(slotShowShareDialog(QString, QString, bool)));
connect(FolderMan::instance()->socketApi(), SIGNAL(shareEmailCommandReceived(QString,QString,bool)),
_gui, SLOT(slowSendShareLink(QString, QString, bool)));
// startup procedure.
connect(&_checkConnectionTimer, SIGNAL(timeout()), this, SLOT(slotCheckConnection()));
+1 -1
Ver Arquivo
@@ -1001,7 +1001,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction, bool *cancel)
void Folder::slotAboutToRestoreBackup(bool *restore)
{
QString msg =
tr("This sync would reset the files to an erlier time in the sync folder '%1'.\n"
tr("This sync would reset the files to an earlier time in the sync folder '%1'.\n"
"This might be because a backup was restored on the server.\n"
"Continuing the sync as normal will cause all your files to be overwritten by an older "
"file in an earlier state. "
+1 -1
Ver Arquivo
@@ -584,7 +584,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list)
QStringList sortedSubfolders = list;
// skip the parent item (first in the list)
sortedSubfolders.erase(sortedSubfolders.begin());
sortedSubfolders.sort();
Utility::sortFilenames(sortedSubfolders);
QVarLengthArray<int, 10> undecidedIndexes;
+1 -1
Ver Arquivo
@@ -308,7 +308,7 @@ void FolderWizardRemotePath::slotUpdateDirectories(const QStringList &list)
root->setData(0, Qt::UserRole, "/");
}
QStringList sortedList = list;
sortedList.sort();
Utility::sortFilenames(sortedList);
foreach (QString path, sortedList) {
path.remove(webdavFolder);
QStringList paths = path.split('/');
+23
Ver Arquivo
@@ -20,6 +20,7 @@
#include "progressdispatcher.h"
#include "owncloudsetupwizard.h"
#include "sharedialog.h"
#include "shareemailwidget.h"
#if defined(Q_OS_MAC)
# include "settingsdialogmac.h"
# include "macwindow.h" // qtmacgoodies
@@ -911,5 +912,27 @@ void ownCloudGui::slotRemoveDestroyedShareDialogs()
}
}
void ownCloudGui::slowSendShareLink(const QString &sharePath, const QString &localPath, bool resharingAllowed)
{
const auto folder = FolderMan::instance()->folderForPath(localPath);
if (!folder) {
qDebug() << "Could not open share email widget for" << localPath << "no responsible folder found";
return;
}
// For https://github.com/owncloud/client/issues/3783
_settingsDialog->hide();
if (!resharingAllowed) {
qDebug() << "Could not open share email widget for" << localPath << "no reshare permissions";
return;
}
qDebug() << Q_FUNC_INFO << "Opening share email widget" << sharePath << localPath;
ShareEmailWidget *w = new ShareEmailWidget(folder->accountState()->account(), sharePath);
w->setAttribute( Qt::WA_DeleteOnClose, true );
raiseDialog(w);
}
} // end namespace
+1
Ver Arquivo
@@ -79,6 +79,7 @@ public slots:
void slotTrayMessageIfServerUnsupported(Account *account);
void slotShowShareDialog(const QString &sharePath, const QString &localPath, bool resharingAllowed);
void slotRemoveDestroyedShareDialogs();
void slowSendShareLink(const QString &sharePath, const QString &localPath, bool resharingAllowed);
private slots:
void slotDisplayIdle();
+1 -1
Ver Arquivo
@@ -222,7 +222,7 @@ void SelectiveSyncTreeView::slotUpdateDirectories(QStringList list)
}
}
list.sort();
Utility::sortFilenames(list);
foreach (QString path, list) {
auto size = job ? job->_sizes.value(path) : 0;
path.remove(pathToRemove);
+59
Ver Arquivo
@@ -0,0 +1,59 @@
#include "shareemailwidget.h"
#include "share.h"
#include <QDesktopServices>
#include <QSharedPointer>
#include <QUrl>
namespace OCC {
ShareEmailWidget::ShareEmailWidget(AccountPtr account,
const QString &sharePath,
QWidget *parent)
: QWidget(parent),
_account(account),
_sharePath(sharePath)
{
resize(200,200);
_layout.addWidget(&_spinner);
_layout.addWidget(&_label);
_label.setText(tr("Fetching share link"));
_spinner.startAnimation();
setLayout(&_layout);
/*
* Create the share manager and connect it properly
*/
_manager = new ShareManager(_account, this);
connect(_manager, SIGNAL(linkShareCreated(QSharedPointer<LinkShare>)), this, SLOT(slotLinkShareCreated(QSharedPointer<LinkShare>)));
_manager->createLinkShare(_sharePath);
}
ShareEmailWidget::~ShareEmailWidget()
{
}
void ShareEmailWidget::slotLinkShareCreated(const QSharedPointer<LinkShare> share)
{
QUrl mailto("mailto:");
QString body = tr("I shared a file with you at %1.").arg(share->getLink().toString());
if (share->getExpireDate().isValid()) {
body += tr("\nThis share expires at %1.").arg(share->getExpireDate().toString());
}
mailto.setQuery("body?"+body);
// Open app
QDesktopServices::openUrl(mailto);
close();
}
}
+46
Ver Arquivo
@@ -0,0 +1,46 @@
#ifndef SHAREEMAILDIALOG_H
#define SHAREEMAILDIALOG_H
#include "accountfwd.h"
#include "QProgressIndicator.h"
#include "share.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QSharedPointer>
#include <QString>
#include <QWidget>
namespace OCC {
class ShareManager;
class ShareEmailWidget : public QWidget
{
public:
explicit ShareEmailWidget(AccountPtr account,
const QString &sharePath,
QWidget *parent = 0);
~ShareEmailWidget();
private slots:
void slotLinkShareCreated(const QSharedPointer<LinkShare> share);
void slotPasswordEnterd();
void slotPasswordRequired();
private:
void share(const QString &sharePath, const QString &password);
AccountPtr _account;
QString _sharePath;
QHBoxLayout _layout;
QLabel _label;
QProgressIndicator _spinner;
ShareManager *_manager;
};
}
#endif // SHAREEMAILDIALOG_H
+1 -3
Ver Arquivo
@@ -72,9 +72,7 @@ ShareUserGroupWidget::ShareUserGroupWidget(AccountPtr account,
_completer->setModel(_completerModel);
_completer->setCaseSensitivity(Qt::CaseInsensitive);
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
_completer->setFilterMode(Qt::MatchContains);
#endif
_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
_ui->shareeLineEdit->setCompleter(_completer);
_manager = new ShareManager(_account, this);
+60
Ver Arquivo
@@ -453,6 +453,66 @@ void SocketApi::command_SHARE_MENU_TITLE(const QString &, QIODevice* socket)
sendMessage(socket, QLatin1String("SHARE_MENU_TITLE:") + tr("Share with %1", "parameter is ownCloud").arg(Theme::instance()->appNameGUI()));
}
void SocketApi::command_SHARE_EMAIL(const QString& localFile, QIODevice* socket)
{
if (!socket) {
qDebug() << Q_FUNC_INFO << "No valid socket object.";
return;
}
qDebug() << Q_FUNC_INFO << localFile;
auto theme = Theme::instance();
Folder *shareFolder = FolderMan::instance()->folderForPath(localFile);
if (!shareFolder) {
const QString message = QLatin1String("SHARE_EMAIL:NOP:")+QDir::toNativeSeparators(localFile);
// files that are not within a sync folder are not synced.
sendMessage(socket, message);
} else if (!shareFolder->accountState()->isConnected()) {
const QString message = QLatin1String("SHARE_EMAIL:NOTCONNECTED:")+QDir::toNativeSeparators(localFile);
// if the folder isn't connected, don't open the share dialog
sendMessage(socket, message);
} else if (!theme->linkSharing()) {
const QString message = QLatin1String("SHARE_EMAIL:NOP:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
} else {
const QString localFileClean = QDir::cleanPath(localFile);
const QString file = localFileClean.mid(shareFolder->cleanPath().length()+1);
SyncFileStatus fileStatus = shareFolder->syncEngine().syncFileStatusTracker().fileStatus(file);
// Verify the file is on the server (to our knowledge of course)
if (fileStatus.tag() != SyncFileStatus::StatusUpToDate) {
const QString message = QLatin1String("SHARE:NOTSYNCED:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
return;
}
const QString remotePath = QDir(shareFolder->remotePath()).filePath(file);
// Can't share root folder
if (remotePath == "/") {
const QString message = QLatin1String("SHARE_EMAIL:CANNOTSHAREROOT:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
return;
}
SyncJournalFileRecord rec = shareFolder->journalDb()->getFileRecord(localFileClean);
bool allowReshare = true; // lets assume the good
if( rec.isValid() ) {
// check the permission: Is resharing allowed?
if( !rec._remotePerm.contains('R') ) {
allowReshare = false;
}
}
const QString message = QLatin1String("SHARE_EMAIL:OK:")+QDir::toNativeSeparators(localFile);
sendMessage(socket, message);
emit shareEmailCommandReceived(remotePath, localFileClean, allowReshare);
}
}
QString SocketApi::buildRegisterPathMessage(const QString& path)
{
QFileInfo fi(path);
+2
Ver Arquivo
@@ -56,6 +56,7 @@ public slots:
signals:
void shareCommandReceived(const QString &sharePath, const QString &localPath, bool resharingAllowed);
void shareUserGroupCommandReceived(const QString &sharePath, const QString &localPath, bool resharingAllowed);
void shareEmailCommandReceived(const QString &sharePath, const QString &localPath, bool resharingAllowed);
private slots:
void slotNewConnection();
@@ -70,6 +71,7 @@ private:
Q_INVOKABLE void command_RETRIEVE_FOLDER_STATUS(const QString& argument, QIODevice* socket);
Q_INVOKABLE void command_RETRIEVE_FILE_STATUS(const QString& argument, QIODevice* socket);
Q_INVOKABLE void command_SHARE(const QString& localFile, QIODevice* socket);
Q_INVOKABLE void command_SHARE_EMAIL(const QString& localFile, QIODevice* socket);
Q_INVOKABLE void command_VERSION(const QString& argument, QIODevice* socket);
+16
Ver Arquivo
@@ -35,6 +35,10 @@
#else
#include <QStandardPaths>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
#include <QCollator>
#endif
#ifdef Q_OS_UNIX
#include <sys/statvfs.h>
@@ -541,4 +545,16 @@ quint64 Utility::StopWatch::durationOfLap( const QString& lapName ) const
return _lapTimes.value(lapName, 0);
}
void Utility::sortFilenames(QStringList& fileNames)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
QCollator collator;
collator.setNumericMode(true);
collator.setCaseSensitivity(Qt::CaseInsensitive);
qSort(fileNames.begin(), fileNames.end(), collator);
#else
fileNames.sort(Qt::CaseInsensitive);
#endif
}
} // namespace OCC
+5
Ver Arquivo
@@ -136,6 +136,11 @@ namespace Utility
quint64 durationOfLap( const QString& lapName ) const;
};
/**
* @brief Sort a QStringList in a way that's appropriate for filenames
*/
OWNCLOUDSYNC_EXPORT void sortFilenames(QStringList& fileNames);
}
/** @} */ // \addtogroup