本文整理汇总了C++中QSessionManager::sessionId方法的典型用法代码示例。如果您正苦于以下问题:C++ QSessionManager::sessionId方法的具体用法?C++ QSessionManager::sessionId怎么用?C++ QSessionManager::sessionId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSessionManager
的用法示例。
在下文中一共展示了QSessionManager::sessionId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveState
void MobileUiApplication::saveState(QSessionManager & manager) {
//qDebug() << QString("saving session state to id %1").arg(manager.sessionId());
AccountId activeCore = Client::currentCoreAccount().accountId(); // FIXME store this!
SessionSettings s(manager.sessionId());
s.setSessionAge(0);
QtUi::mainWindow()->saveStateToSettings(s);
}
示例2: onSaveState
void ClipboardServer::onSaveState(QSessionManager &sessionManager)
{
COPYQ_LOG("Got save state request from session manager.");
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "copyq", "copyq_no_session");
const auto sessionNameKey = "session_" + sessionManager.sessionId();
const auto sessionName = qApp->property("CopyQ_session_name").toString();
settings.setValue(sessionNameKey, sessionName);
const QString lastSessionIdPrefix = "last_session_id_for_";
const auto lastSessionIdKey = lastSessionIdPrefix + sessionName;
const auto lastSessionId = settings.value(lastSessionIdKey).toString();
const auto lastSessionNameKey = "session_" + lastSessionId;
settings.setValue(lastSessionIdKey, sessionNameKey);
// Remove no longer valid sessions from configuration.
QSet<QString> validSessions;
for (const QString &key : settings.childKeys()) {
if ( key.startsWith(lastSessionIdPrefix) )
validSessions.insert( settings.value(key).toString() );
}
for (const QString &key : settings.childKeys()) {
if ( !key.startsWith(lastSessionIdPrefix) && !validSessions.contains(key) )
settings.remove(key);
}
}
示例3: onSaveState
void ClipboardServer::onSaveState(QSessionManager &sessionManager)
{
COPYQ_LOG("Got save state request from session manager.");
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "copyq", "copyq_no_session");
const auto sessionNameKey = "session_" + sessionManager.sessionId();
const auto sessionName = qApp->property("CopyQ_session_name").toString();
settings.setValue(sessionNameKey, sessionName);
// Remove last session name from configuration.
const auto lastSessionIdKey = "last_session_id_for_" + sessionName;
const auto lastSessionId = settings.value(lastSessionIdKey).toString();
if ( !lastSessionId.isEmpty() ) {
const auto lastSessionNameKey = "session_" + lastSessionId;
settings.remove(lastSessionNameKey);
}
settings.setValue(lastSessionIdKey, sessionNameKey);
}