Example #1
0
void SeafileExtensionHandler::generateShareLink(const QString& repo_id,
                                                const QString& path_in_repo,
                                                bool is_file,
                                                bool internal)
{
    // qDebug("path_in_repo: %s", path_in_repo.toUtf8().data());
    const Account account = seafApplet->accountManager()->getAccountByRepo(repo_id);
    if (!account.isValid()) {
        return;
    }

    if (internal) {
        QString path = path_in_repo;
        if (!is_file && !path.endsWith("/")) {
            path += "/";
        }
        SeafileLinkDialog *dialog = new SeafileLinkDialog(repo_id, account, path, NULL);
        dialog->setAttribute(Qt::WA_DeleteOnClose);
        dialog->show();
        dialog->raise();
        dialog->activateWindow();
    } else {
        GetSharedLinkRequest *req = new GetSharedLinkRequest(
            account, repo_id, path_in_repo, is_file);

        connect(req, SIGNAL(success(const QString&)),
                this, SLOT(onShareLinkGenerated(const QString&)));

        req->send();
    }
}
Example #2
0
void DataManager::shareDirent(const QString &repo_id,
                              const QString &path,
                              bool is_file)
{
    GetSharedLinkRequest *req = new GetSharedLinkRequest(account_, repo_id,
                                                         path, is_file);
    connect(req, SIGNAL(success(const QString&)),
            SIGNAL(shareDirentSuccess(const QString&)));

    connect(req, SIGNAL(failed(const ApiError&)),
            SIGNAL(shareDirentFailed(const ApiError&)));
    reqs_.push_back(req);
    req->send();
}
Example #3
0
void SeafileExtensionHandler::generateShareLink(const QString& repo_id,
                                                const QString& path_in_repo,
                                                bool is_file)
{
    // qDebug("path_in_repo: %s", path_in_repo.toUtf8().data());
    const Account account = seafApplet->accountManager()->getAccountByRepo(repo_id);
    if (!account.isValid()) {
        return;
    }

    GetSharedLinkRequest *req = new GetSharedLinkRequest(
        account, repo_id, path_in_repo, is_file);

    connect(req, SIGNAL(success(const QString&)),
            this, SLOT(onShareLinkGenerated(const QString&)));

    req->send();
}