"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/ext-handler.cpp" between
seafile-client-7.0.4.tar.gz and seafile-client-7.0.5.tar.gz

About: Seafile (client) for the Seafile cloud storage system.

ext-handler.cpp  (seafile-client-7.0.4):ext-handler.cpp  (seafile-client-7.0.5)
skipping to change at line 166 skipping to change at line 166
this, SLOT(lockFile(const QString&, const QString&, bool))); this, SLOT(lockFile(const QString&, const QString&, bool)));
connect(listener_thread_, SIGNAL(privateShare(const QString&, const QString& , bool)), connect(listener_thread_, SIGNAL(privateShare(const QString&, const QString& , bool)),
this, SLOT(privateShare(const QString&, const QString&, bool))); this, SLOT(privateShare(const QString&, const QString&, bool)));
connect(listener_thread_, SIGNAL(openUrlWithAutoLogin(const QUrl&)), connect(listener_thread_, SIGNAL(openUrlWithAutoLogin(const QUrl&)),
this, SLOT(openUrlWithAutoLogin(const QUrl&))); this, SLOT(openUrlWithAutoLogin(const QUrl&)));
connect(listener_thread_, SIGNAL(showLockedBy(const QString&, const QString& )), connect(listener_thread_, SIGNAL(showLockedBy(const QString&, const QString& )),
this, SLOT(showLockedBy(const QString&, const QString&))); this, SLOT(showLockedBy(const QString&, const QString&)));
connect(listener_thread_, SIGNAL(getUploadLink(const QString&, const QString
&)),
this, SLOT(getUploadLink(const QString&, const QString&)));
} }
void SeafileExtensionHandler::start() void SeafileExtensionHandler::start()
{ {
listener_thread_->start(); listener_thread_->start();
ReposInfoCache::instance()->start(); ReposInfoCache::instance()->start();
started_ = true; started_ = true;
} }
void SeafileExtensionHandler::stop() void SeafileExtensionHandler::stop()
skipping to change at line 310 skipping to change at line 313
} }
} }
void SeafileExtensionHandler::onLockFileFailed(const ApiError& error) void SeafileExtensionHandler::onLockFileFailed(const ApiError& error)
{ {
LockFileRequest *req = qobject_cast<LockFileRequest *>(sender()); LockFileRequest *req = qobject_cast<LockFileRequest *>(sender());
QString str = req->lock() ? tr("Failed to lock file") : tr("Failed to unlock file"); QString str = req->lock() ? tr("Failed to lock file") : tr("Failed to unlock file");
seafApplet->warningBox(QString("%1: %2").arg(str, error.toString())); seafApplet->warningBox(QString("%1: %2").arg(str, error.toString()));
} }
void SeafileExtensionHandler::getUploadLink(const QString& repo_id, const QStrin
g& path_in_repo)
{
const Account account =
seafApplet->accountManager()->getAccountByRepo(repo_id);
if (!account.isValid()) {
return;
}
GetUploadLinkRequest *req = new GetUploadLinkRequest(
account, repo_id, "/" + path_in_repo);
connect(req, SIGNAL(success(const QString&)), this,
SLOT(onGetUploadLinkSuccess(const QString)));
connect(req, SIGNAL(failed(const ApiError&)), this,
SLOT(onGetUploadLinkFailed(const ApiError&)));
req->send();
}
void SeafileExtensionHandler::onGetUploadLinkSuccess(const QString& upload_link)
{
SharedLinkDialog *dialog = new SharedLinkDialog(upload_link, NULL, false);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
dialog->raise();
dialog->activateWindow();
}
void SeafileExtensionHandler::onGetUploadLinkFailed(const ApiError& error)
{
GetUploadLinkRequest *req = qobject_cast<GetUploadLinkRequest *>(sender());
const QString file = ::getBaseName(req->path());
seafApplet->messageBox(tr("Failed to get upload link information for file \"
%1\"").arg(file));
req->deleteLater();
}
void SeafileExtensionHandler::showLockedBy(const QString& repo_id, const QString & path_in_repo) void SeafileExtensionHandler::showLockedBy(const QString& repo_id, const QString & path_in_repo)
{ {
// qWarning("SeafileExtensionHandler::showLockedBy is called for %s %s\n", // qWarning("SeafileExtensionHandler::showLockedBy is called for %s %s\n",
// toCStr(repo_id), // toCStr(repo_id),
// toCStr(path_in_repo)); // toCStr(path_in_repo));
const Account account = const Account account =
seafApplet->accountManager()->getAccountByRepo(repo_id); seafApplet->accountManager()->getAccountByRepo(repo_id);
if (!account.isValid()) { if (!account.isValid()) {
return; return;
} }
skipping to change at line 411 skipping to change at line 449
connect(t, SIGNAL(generateShareLink(const QString&, const QString&, bool, bo ol)), connect(t, SIGNAL(generateShareLink(const QString&, const QString&, bool, bo ol)),
this, SIGNAL(generateShareLink(const QString&, const QString&, bool, bool))); this, SIGNAL(generateShareLink(const QString&, const QString&, bool, bool)));
connect(t, SIGNAL(lockFile(const QString&, const QString&, bool)), connect(t, SIGNAL(lockFile(const QString&, const QString&, bool)),
this, SIGNAL(lockFile(const QString&, const QString&, bool))); this, SIGNAL(lockFile(const QString&, const QString&, bool)));
connect(t, SIGNAL(privateShare(const QString&, const QString&, bool)), connect(t, SIGNAL(privateShare(const QString&, const QString&, bool)),
this, SIGNAL(privateShare(const QString&, const QString&, bool))); this, SIGNAL(privateShare(const QString&, const QString&, bool)));
connect(t, SIGNAL(openUrlWithAutoLogin(const QUrl&)), connect(t, SIGNAL(openUrlWithAutoLogin(const QUrl&)),
this, SIGNAL(openUrlWithAutoLogin(const QUrl&))); this, SIGNAL(openUrlWithAutoLogin(const QUrl&)));
connect(t, SIGNAL(showLockedBy(const QString&, const QString&)), connect(t, SIGNAL(showLockedBy(const QString&, const QString&)),
this, SIGNAL(showLockedBy(const QString&, const QString&))); this, SIGNAL(showLockedBy(const QString&, const QString&)));
connect(t, SIGNAL(getUploadLink(const QString&, const QString&)),
this, SIGNAL(getUploadLink(const QString&, const QString&)));
t->start(); t->start();
} }
ExtCommandsHandler::ExtCommandsHandler(HANDLE pipe) ExtCommandsHandler::ExtCommandsHandler(HANDLE pipe)
{ {
pipe_ = pipe; pipe_ = pipe;
} }
void ExtCommandsHandler::run() void ExtCommandsHandler::run()
{ {
skipping to change at line 451 skipping to change at line 491
} else if (cmd == "unlock-file") { } else if (cmd == "unlock-file") {
handleLockFile(args, false); handleLockFile(args, false);
} else if (cmd == "private-share-to-group") { } else if (cmd == "private-share-to-group") {
handlePrivateShare(args, true); handlePrivateShare(args, true);
} else if (cmd == "private-share-to-user") { } else if (cmd == "private-share-to-user") {
handlePrivateShare(args, false); handlePrivateShare(args, false);
} else if (cmd == "show-history") { } else if (cmd == "show-history") {
handleShowHistory(args); handleShowHistory(args);
} else if (cmd == "show-locked-by") { } else if (cmd == "show-locked-by") {
handleShowLockedBy(args); handleShowLockedBy(args);
} else if (cmd == "get-upload-link") {
handleGetUploadLink(args);
} else { } else {
qWarning ("[ext] unknown request command: %s", cmd.toUtf8().data()); qWarning ("[ext] unknown request command: %s", cmd.toUtf8().data());
} }
if (!sendResponse(resp)) { if (!sendResponse(resp)) {
qWarning ("failed to write response to shell extension: %s", qWarning ("failed to write response to shell extension: %s",
formatErrorMessage().c_str()); formatErrorMessage().c_str());
break; break;
} }
} }
skipping to change at line 685 skipping to change at line 727
QString wt = normalizedPath(repo.worktree); QString wt = normalizedPath(repo.worktree);
// qDebug("path: %s, repo: %s", path.toUtf8().data(), wt.toUtf8().data() ); // qDebug("path: %s, repo: %s", path.toUtf8().data(), wt.toUtf8().data() );
if (path.length() > wt.length() && path.startsWith(wt) && path.at(wt.len gth()) == '/') { if (path.length() > wt.length() && path.startsWith(wt) && path.at(wt.len gth()) == '/') {
QString path_in_repo = path.mid(wt.size()); QString path_in_repo = path.mid(wt.size());
emit showLockedBy(repo.id, path_in_repo); emit showLockedBy(repo.id, path_in_repo);
break; break;
} }
} }
} }
void ExtCommandsHandler::handleGetUploadLink(const QStringList& args)
{
if (args.size() != 1) {
return;
}
QString path = normalizedPath(args[0]);
foreach (const LocalRepo& repo, listLocalRepos()) {
QString wt = normalizedPath(repo.worktree);
// qDebug("path: %s, repo: %s", path.toUtf8().data(), wt.toUtf8().data()
);
if (path.length() > wt.length() && path.startsWith(wt) && path.at(wt.len
gth()) == '/') {
QString path_in_repo = path.mid(wt.size());
emit getUploadLink(repo.id, path_in_repo);
break;
}
}
}
SINGLETON_IMPL(ReposInfoCache) SINGLETON_IMPL(ReposInfoCache)
ReposInfoCache::ReposInfoCache(QObject * parent) ReposInfoCache::ReposInfoCache(QObject * parent)
: QObject(parent) : QObject(parent)
{ {
cache_ts_ = 0; cache_ts_ = 0;
rpc_client_ = new SeafileRpcClient(); rpc_client_ = new SeafileRpcClient();
connect(seafApplet->daemonManager(), SIGNAL(daemonRestarted()), this, SLOT(o nDaemonRestarted())); connect(seafApplet->daemonManager(), SIGNAL(daemonRestarted()), this, SLOT(o nDaemonRestarted()));
} }
 End of changes. 5 change blocks. 
0 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)