本文整理汇总了C++中AccountPtr类的典型用法代码示例。如果您正苦于以下问题:C++ AccountPtr类的具体用法?C++ AccountPtr怎么用?C++ AccountPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccountPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupBrowser
void OwncloudShibbolethCredsPage::setupBrowser()
{
if (!_browser.isNull()) {
return;
}
OwncloudWizard *ocWizard = qobject_cast<OwncloudWizard *>(wizard());
AccountPtr account = ocWizard->account();
// we need to reset the cookie jar to drop temporary cookies (like the shib cookie)
// i.e. if someone presses "back"
QNetworkAccessManager *qnam = account->networkAccessManager();
CookieJar *jar = new CookieJar;
jar->restore(account->cookieJarPath());
// Implicitly deletes the old cookie jar, and reparents the jar
qnam->setCookieJar(jar);
_browser = new ShibbolethWebView(account);
connect(_browser.data(), &ShibbolethWebView::shibbolethCookieReceived,
this, &OwncloudShibbolethCredsPage::slotShibbolethCookieReceived, Qt::QueuedConnection);
connect(_browser.data(), &ShibbolethWebView::rejected,
this, &OwncloudShibbolethCredsPage::slotBrowserRejected);
_browser->move(ocWizard->x(), ocWizard->y());
_browser->show();
_browser->setFocus();
}
示例2: fetchPrivateLinkUrl
void fetchPrivateLinkUrl(AccountPtr account, const QString &remotePath,
const QByteArray &numericFileId, QObject *target,
std::function<void(const QString &url)> targetFun)
{
QString oldUrl;
if (!numericFileId.isEmpty())
oldUrl = account->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded);
// Retrieve the new link by PROPFIND
PropfindJob *job = new PropfindJob(account, remotePath, target);
job->setProperties(
QList<QByteArray>()
<< "http://owncloud.org/ns:fileid" // numeric file id for fallback private link generation
<< "http://owncloud.org/ns:privatelink");
job->setTimeout(10 * 1000);
QObject::connect(job, &PropfindJob::result, target, [=](const QVariantMap &result) {
auto privateLinkUrl = result["privatelink"].toString();
auto numericFileId = result["fileid"].toByteArray();
if (!privateLinkUrl.isEmpty()) {
targetFun(privateLinkUrl);
} else if (!numericFileId.isEmpty()) {
targetFun(account->deprecatedPrivateLinkUrl(numericFileId).toString(QUrl::FullyEncoded));
} else {
targetFun(oldUrl);
}
});
QObject::connect(job, &PropfindJob::finishedWithError, target, [=](QNetworkReply *) {
targetFun(oldUrl);
});
job->start();
}
示例3: p12ToPem
//called during the validation of the client certificate.
void OwncloudSetupPage::slotCertificateAccepted()
{
QSslCertificate sslCertificate;
resultP12ToPem certif = p12ToPem(addCertDial->getCertificatePath().toStdString() , addCertDial->getCertificatePasswd().toStdString());
if(certif.ReturnCode){
QString s = QString::fromStdString(certif.Certificate);
QByteArray ba = s.toLocal8Bit();
QList<QSslCertificate> sslCertificateList = QSslCertificate::fromData(ba, QSsl::Pem);
sslCertificate = sslCertificateList.takeAt(0);
_ocWizard->ownCloudCertificate = ba;
_ocWizard->ownCloudPrivateKey = certif.PrivateKey.c_str();
_ocWizard->ownCloudCertificatePath = addCertDial->getCertificatePath();
_ocWizard->ownCloudCertificatePasswd = addCertDial->getCertificatePasswd();
AccountPtr acc = _ocWizard->account();
acc->setCertificate(_ocWizard->ownCloudCertificate, _ocWizard->ownCloudPrivateKey);
addCertDial->reinit();
validatePage();
} else {
QString message;
message = certif.Comment.c_str();
addCertDial->showErrorMessage(message);
addCertDial->show();
}
}
示例4: find_account
void
Opal::Bank::on_mwi_event (std::string aor,
std::string info)
{
AccountPtr account = find_account (aor);
if (account)
account->handle_message_waiting_information (info);
}
示例5: AbstractNetworkJob
AvatarJob::AvatarJob(AccountPtr account, const QString &userId, int size, QObject *parent)
: AbstractNetworkJob(account, QString(), parent)
{
if (account->serverVersionInt() >= Account::makeServerVersion(10, 0, 0)) {
_avatarUrl = Utility::concatUrlPath(account->url(), QString("remote.php/dav/avatars/%1/%2.png").arg(userId, QString::number(size)));
} else {
_avatarUrl = Utility::concatUrlPath(account->url(), QString("index.php/avatar/%1/%2").arg(userId, QString::number(size)));
}
}
示例6: cleanupPage
void AbstractCredentialsWizardPage::cleanupPage()
{
// Reset the credentials when the 'Back' button is used.
AccountPtr account = static_cast<OwncloudWizard *>(wizard())->account();
AbstractCredentials *creds = account->credentials();
if (creds && !qobject_cast<DummyCredentials *>(creds)) {
account->setCredentials(new DummyCredentials);
}
}
示例7: canGetQuota
bool QuotaInfo::canGetQuota() const
{
if (! _accountState || !_active) {
return false;
}
AccountPtr account = _accountState->account();
return _accountState->isConnected()
&& account->credentials()
&& account->credentials()->ready();
}
示例8: slotCleanup
void Application::slotCleanup()
{
// explicitly close windows. This is somewhat of a hack to ensure
// that saving the geometries happens ASAP during a OS shutdown
AccountPtr account = AccountManager::instance()->account();
if (account) {
account->save();
}
FolderMan::instance()->unloadAndDeleteAllFolders();
_gui->slotShutdown();
_gui->deleteLater();
}
示例9: ShowShort
std::string Trace::ShowShort()
{
std::string editedby = "unknown";
try {
AccountPtr account = mud::AccountManager::Get()->GetByKey(getAccount());
editedby = account->getName();
} catch(RowNotFoundException& e) {
}
return Global::Get()->sprintf("%s (%ld): %s\n",
editedby.c_str(),
getTime(),
getDescription().c_str());
}
示例10: slotLogout
void Application::slotLogout()
{
AccountState* ai = AccountStateManager::instance()->accountState();
if (ai) {
AccountPtr a = ai->account();
// invalidate & forget token/password
a->credentials()->invalidateToken();
// terminate all syncs and unload folders
FolderMan *folderMan = FolderMan::instance();
folderMan->setSyncEnabled(false);
folderMan->terminateSyncProcess();
ai->setSignedOut(true);
// show result
_gui->slotComputeOverallSyncStatus();
}
}
示例11: PendingOperation
/**
* Construct a new PendingChannelRequest object that always fails.
*
* \param account Account to use.
* \param errorName The name of a D-Bus error.
* \param errorMessage The error message.
*/
PendingChannelRequest::PendingChannelRequest(const AccountPtr &account,
const QString &errorName, const QString &errorMessage)
: PendingOperation(ConnectionPtr()),
mPriv(new Private(account->dbusConnection()))
{
setFinishedWithError(errorName, errorMessage);
}
示例12: QObject
AccountState::AccountState(AccountPtr account)
: QObject(account.data())
, _account(account)
, _quotaInfo(0)
, _state(AccountState::Disconnected)
, _connectionStatus(ConnectionValidator::Undefined)
, _waitingForNewCredentials(false)
{
qRegisterMetaType<AccountState*>("AccountState*");
_quotaInfo = new QuotaInfo(this); // Need to be initialized when 'this' is fully initialized
connect(account.data(), SIGNAL(invalidCredentials()),
SLOT(slotInvalidCredentials()));
connect(account.data(), SIGNAL(credentialsFetched(AbstractCredentials*)),
SLOT(slotCredentialsFetched(AbstractCredentials*)));
}
示例13: cleanupPage
void AbstractCredentialsWizardPage::cleanupPage()
{
// Reset the credentials when the 'Back' button is used.
// Unfortunately this code is also run when the Wizard finishes
// prematurely with 'Skip Folder Configuration'. Therefore we need to
// avoid resetting credentials on active accounts.
AccountPtr account = static_cast<OwncloudWizard*>(wizard())->account();
if (account == AccountManager::instance()->account())
return;
AbstractCredentials *creds = account->credentials();
if (creds) {
if (!creds->inherits("DummyCredentials")) {
account->setCredentials(CredentialsFactory::create("dummy"));
}
}
}
示例14: catch
std::vector<std::string> Trace::Show()
{
std::vector<std::string> result;
std::string editedby = "unknown";
try {
AccountPtr account = mud::AccountManager::Get()->GetByKey(getAccount());
editedby = account->getName();
} catch(RowNotFoundException& e) {
}
result.push_back(Global::Get()->sprintf("Account: '%s'.", editedby.c_str()));
result.push_back(Global::Get()->sprintf("Description: '%s'.", getDescription().c_str()));
result.push_back(Global::Get()->sprintf("Diff: %s.", getDiff().c_str()));
result.push_back(Global::Get()->sprintf("Time: %ld.", getTime()));
return result;
}
示例15: m_accPtr
AccountListener::AccountListener(AccountPtr ptr) : m_accPtr(ptr) {
QObject::connect(ptr.data()->becomeReady(), SIGNAL(finished(Tp::PendingOperation *)), this, SLOT(accountReady(Tp::PendingOperation *)));
QObject::connect(m_accPtr.data(), SIGNAL(statusChanged(Tp::ConnectionStatus,
Tp::ConnectionStatusReason,
const QString &, const QVariantMap &)),
this, SLOT(statusChanged(Tp::ConnectionStatus,
Tp::ConnectionStatusReason,
const QString &, const QVariantMap &)));
}