本文整理汇总了C++中KConfigGroup::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup::isValid方法的具体用法?C++ KConfigGroup::isValid怎么用?C++ KConfigGroup::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfigGroup
的用法示例。
在下文中一共展示了KConfigGroup::isValid方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createNotification
void FdoSelectionManagerPrivate::createNotification(WId winId)
{
if (!tasks.contains(winId)) {
kDebug() << "message request from unknown task" << winId;
return;
}
MessageRequest &request = messageRequests[winId];
Task *task = tasks[winId];
QString message = QString::fromUtf8(request.message);
message = QTextDocument(message).toHtml();
if (!notificationsEngine) {
notificationsEngine = Plasma::DataEngineManager::self()->loadEngine("notifications");
}
//FIXME: who is the source in this case?
Plasma::Service *service = notificationsEngine->serviceForSource("notification");
KConfigGroup op = service->operationDescription("createNotification");
if (op.isValid()) {
op.writeEntry("appName", task->name());
//FIXME: find a way to pass icons trough here
op.writeEntry("appIcon", task->name());
//op.writeEntry("summary", task->name());
op.writeEntry("body", message);
op.writeEntry("timeout", (int)request.timeout);
KJob *job = service->startOperationCall(op);
QObject::connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
} else {
delete service;
kDebug() << "invalid operation";
}
}
示例2: initialize
void MetaListViewWidget::initialize(QAbstractItemModel *model, const KConfigGroup & group)
{
m_listView->setModel(model);
if ( group.isValid() ) {
setMetaBarPosition( readEntry(group, "metaBarPosition", Right) );
setListViewMode( readEntry(group, "listViewMode", QListView::ListMode) );
m_splitter->restoreState( group.readEntry("splitterState", QByteArray()) );
m_configGroup = group;
} else {
setMetaBarPosition(Right);
setListViewMode(QListView::ListMode);
}
//### Disabled feature; this should not be user-configurable. depends on the model.
setMultipleSelectionEnabled(false);
QItemSelectionModel *selModel = m_listView->selectionModel();
connect(selModel, SIGNAL(selectionChanged(QItemSelection, QItemSelection )),
SIGNAL(selectionChanged(QItemSelection)) );
connect(m_listView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(slotContextMenuRequested(QPoint)) );
loadGlobalPreferences();
connect(qtwineApp, SIGNAL(preferencesChanged()), this, SLOT(loadGlobalPreferences()) );
}
示例3: loadAction
bool SuspendSession::loadAction(const KConfigGroup& config)
{
if (config.isValid() && config.hasKey("idleTime") && config.hasKey("suspendType")) {
// Add the idle timeout
m_idleTime = config.readEntry<int>("idleTime", 0);
if (m_idleTime) {
registerIdleTimeout(m_idleTime - 5000);
registerIdleTimeout(m_idleTime);
}
m_autoType = config.readEntry<uint>("suspendType", 0);
}
return true;
}
示例4: init
void PlasmoidProtocol::init()
{
//this should never happen
if (m_containment) {
return;
}
Host* h = qobject_cast<Host*>(parent());
QQuickItem* rootItem = h->rootItem();
if (rootItem) {
m_systrayApplet = rootItem->property("_plasma_applet").value<Plasma::Applet*>();
}
if (!m_systrayApplet) {
qWarning() << "Don't have a parent applet, Can't initialize the Plasmoid protocol!!!";
return;
}
int containmentId = 0;
KConfigGroup cg = m_systrayApplet->config();
cg = KConfigGroup(&cg, "Containments");
if (cg.isValid() && cg.groupList().size()) {
containmentId = cg.groupList().first().toInt();
}
m_containment = new Plasma::Containment(m_systrayApplet, QStringLiteral("null"), containmentId);
m_containment->setImmutability(Plasma::Types::Mutable);
m_containment->setFormFactor(Plasma::Types::Horizontal);
m_containment->setLocation(m_systrayApplet->location());
m_containment->setContainmentActions(QStringLiteral("RightButton;NoModifier"), QStringLiteral("org.kde.contextmenu"));
m_containment->init();
emit m_systrayApplet->containment()->corona()->containmentAdded(m_containment);
connect(m_systrayApplet, &Plasma::Applet::locationChanged, this, [=]() {
m_containment->setLocation(m_systrayApplet->location());
});
m_systrayApplet->setProperty("containment", QVariant::fromValue(m_containment));
restorePlasmoids();
}
示例5: readFromDesktopFile
bool KgTheme::readFromDesktopFile(const QString& path_)
{
if (path_.isEmpty())
{
qCDebug(GAMES_LIB) << "Refusing to load theme with no name";
return false;
}
//legacy support: relative paths are resolved with KStandardDirs/appdata
QString path(path_);
if (QFileInfo(path).isRelative())
{
path = QStandardPaths::locate(QStandardPaths::DataLocation, path);
if (path.isEmpty())
{
qCDebug(GAMES_LIB) << "Could not find theme description" << path;
return false;
}
}
//default group name
if (Private::s_configGroupNames.isEmpty())
{
Private::s_configGroupNames << QLatin1String("KGameTheme");
}
//open file, look for a known config group
KConfig config(path, KConfig::SimpleConfig);
KConfigGroup group;
foreach (const QString& groupName, Private::s_configGroupNames)
{
if (config.hasGroup(groupName))
{
group = config.group(groupName);
}
}
if (!group.isValid())
{
qCDebug(GAMES_LIB) << "Could not read theme description at" << path;
return false;
}
//check format version
if (group.readEntry("VersionFormat", 1) > 1)
{
qCDebug(GAMES_LIB) << "Format of theme description too new at" << path;
return false;
}
//resolve paths
const QFileInfo fi(path);
const QDir dir = fi.dir();
QString graphicsPath = group.readEntry("FileName", QString());
if (!graphicsPath.isEmpty() && QFileInfo(graphicsPath).isRelative())
graphicsPath = dir.absoluteFilePath(graphicsPath);
QString previewPath = group.readEntry("Preview", QString());
if (!previewPath.isEmpty() && QFileInfo(previewPath).isRelative())
previewPath = dir.absoluteFilePath(previewPath);
//create theme
setName(group.readEntry("Name", QString()));
setDescription(group.readEntry("Description", QString()));
setAuthor(group.readEntry("Author", QString()));
setAuthorEmail(group.readEntry("AuthorEmail", QString()));
setGraphicsPath(graphicsPath);
setPreviewPath(previewPath);
setCustomData(group.entryMap());
//store modification date of this file in private property (KGameRenderer
//wants to clear its cache also if the theme description changes)
setProperty("_k_themeDescTimestamp", fi.lastModified().toTime_t());
return true;
}