ShareDialog: Disable sharing of external files.

See https://github.com/owncloud/client/issues/2732 for discussion.
This commit is contained in:
Klaas Freitag 2015-01-29 18:09:46 +01:00
parent 37f19dd0fe
commit d2f1e6e03e
3 changed files with 16 additions and 14 deletions

View file

@ -66,9 +66,14 @@ ShareDialog::ShareDialog(AccountPtr account, const QString &sharePath, const QSt
// check if the file is already inside of a synced folder
if( sharePath.isEmpty() ) {
// The file is not yet in ownCloud. It must be copied into first.
_ui->checkBox_shareLink->setEnabled(false);
uploadExternalFile();
// The file is not yet in an ownCloud synced folder. We could automatically
// copy it over, but that is skipped as not all questions can be anwered that
// are involved in that, see https://github.com/owncloud/client/issues/2732
//
// _ui->checkBox_shareLink->setEnabled(false);
// uploadExternalFile();
qDebug() << Q_FUNC_INFO << "Unable to share files not in a sync folder.";
return;
}
// error label, red box and stuff
@ -344,6 +349,11 @@ void ShareDialog::displayInfo( const QString& msg )
_ui->label_sharePath->setText(msg);
}
#if 0
/*
* This code is disabled for now as we do not have answers for all the questions involved
* here, see https://github.com/owncloud/client/issues/2732
*/
bool ShareDialog::uploadExternalFile()
{
bool re = false;
@ -446,7 +456,7 @@ void ShareDialog::slotNextSyncFinished( const SyncResult& result )
}
_expectedSyncFile.clear();
}
#endif
OcsShareJob::OcsShareJob(const QByteArray &verb, const QUrl &url, AccountPtr account, QObject* parent)
: AbstractNetworkJob(account, "", parent),

View file

@ -59,9 +59,6 @@ public:
~ShareDialog();
void getShares();
public slots:
void slotNextSyncFinished( const SyncResult& result );
private slots:
void slotSharesFetched(const QString &reply);
void slotCreateShareFetched(const QString &reply);
@ -77,8 +74,6 @@ private:
void displayError(int code);
void displayInfo( const QString& msg );
bool uploadExternalFile();
Ui::ShareDialog *_ui;
AccountPtr _account;
QString _sharePath;

View file

@ -408,11 +408,8 @@ void SocketApi::command_SHARE(const QString& localFile, SocketType* socket)
Folder *shareFolder = FolderMan::instance()->folderForPath(localFile);
if (!shareFolder) {
const QString message = QLatin1String("SHARE:OK:")+QDir::toNativeSeparators(localFile);
// FIXME: We could send here a "SHARE:PROGRESS" message back as this op will probably
// take longer. But currently we lack a way of getting a message once that has successfully
// worked.
emit shareCommandReceived(QString(), localFile);
const QString message = QLatin1String("SHARE:NOP:")+QDir::toNativeSeparators(localFile);
// files that are not within a sync folder are not synced.
sendMessage(socket, message);
} else {
const QString message = QLatin1String("SHARE:OK:")+QDir::toNativeSeparators(localFile);