void LinkShare::slotExpireDateSet(const QVariantMap& reply, const QVariant &value) { auto data = reply.value("ocs").toMap().value("data").toMap(); /* * If the reply provides a data back (more REST style) * they use this date. */ if (data.value("expiration").isValid()) { _expireDate = QDate::fromString(data.value("expiration").toString(), "yyyy-MM-dd 00:00:00"); } else { _expireDate = value.toDate(); } emit expireDateSet(); }
void LinkShare::slotExpireDateSet(const QVariantMap&, const QVariant &value) { _expireDate = value.toDate(); emit expireDateSet(); }
void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares) { const QString versionString = _account->serverVersion(); qDebug() << Q_FUNC_INFO << versionString << "Fetched" << shares.count() << "shares"; //Show link checkbox now if capabilities allow it _ui->checkBox_shareLink->setEnabled(_account->capabilities().sharePublicLink()); _pi_link->stopAnimation(); Q_FOREACH(auto share, shares) { if (share->getShareType() == Share::TypeLink) { _share = qSharedPointerDynamicCast<LinkShare>(share); _ui->pushButton_copy->show(); _ui->pushButton_mail->show(); _ui->widget_shareLink->show(); _ui->checkBox_shareLink->setChecked(true); _ui->checkBox_password->setEnabled(!_passwordRequired); if (_share->isPasswordSet()) { _ui->lineEdit_password->setEnabled(true); _ui->checkBox_password->setChecked(true); _ui->lineEdit_password->setPlaceholderText("********"); _ui->lineEdit_password->setText(QString()); _ui->lineEdit_password->show(); _ui->pushButton_setPassword->show(); } else { _ui->checkBox_password->setChecked(false); // _ui->lineEdit_password->setPlaceholderText("********"); _ui->lineEdit_password->hide(); _ui->pushButton_setPassword->hide(); } _ui->checkBox_expire->setEnabled( !_account->capabilities().sharePublicLinkEnforceExpireDate()); _ui->calendar->setMinimumDate(QDate::currentDate().addDays(1)); if (_share->getExpireDate().isValid()) { _ui->calendar->setDate(_share->getExpireDate()); _ui->calendar->setEnabled(true); _ui->checkBox_expire->setChecked(true); } else { _ui->calendar->setEnabled(false); _ui->checkBox_expire->setChecked(false); } /* * Only directories can have public upload set * For public links the server sets CREATE and UPDATE permissions. */ _ui->checkBox_editing->setEnabled( _account->capabilities().sharePublicLinkAllowUpload()); if (!_isFile) { _ui->checkBox_editing->setChecked(_share->getPublicUpload()); } setShareLink(_share->getLink().toString()); _ui->pushButton_mail->setEnabled(true); _ui->pushButton_copy->setEnabled(true); // Connect all shares signals to gui slots connect(_share.data(), SIGNAL(expireDateSet()), SLOT(slotExpireSet())); connect(_share.data(), SIGNAL(publicUploadSet()), SLOT(slotPublicUploadSet())); connect(_share.data(), SIGNAL(passwordSet()), SLOT(slotPasswordSet())); connect(_share.data(), SIGNAL(shareDeleted()), SLOT(slotDeleteShareFetched())); connect(_share.data(), SIGNAL(serverError(int, QString)), SLOT(slotServerError(int,QString))); connect(_share.data(), SIGNAL(passwordSetError(int, QString)), SLOT(slotPasswordSetError(int,QString))); break; } }