本文整理汇总了C++中KSharedConfigPtr::hasGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ KSharedConfigPtr::hasGroup方法的具体用法?C++ KSharedConfigPtr::hasGroup怎么用?C++ KSharedConfigPtr::hasGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSharedConfigPtr
的用法示例。
在下文中一共展示了KSharedConfigPtr::hasGroup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applicationLanguageList
QStringList KSwitchLanguageDialogPrivate::applicationLanguageList()
{
KSharedConfigPtr config = KGlobal::config();
QStringList languagesList;
if (config->hasGroup("Locale"))
{
KConfigGroup group(config, "Locale");
if (group.hasKey("Language"))
{
languagesList = group.readEntry("Language", QString()).split(':');
}
}
if (languagesList.isEmpty())
{
languagesList = KGlobal::locale()->languageList();
}
KLocale *locale = KGlobal::locale();
for (int i = 0; i < languagesList.count();)
{
if (!locale->isApplicationTranslatedInto(languagesList[i]))
languagesList.removeAt(i);
else
++i;
}
return languagesList;
}
示例2: loadKPrConfig
void KPrDocument::loadKPrConfig()
{
KSharedConfigPtr config = KGlobal::mainComponent().config();
if ( config->hasGroup( "SlideShow" ) ) {
KConfigGroup configGroup = config->group( "SlideShow" );
m_presentationMonitor = configGroup.readEntry<int>( "PresentationMonitor", 0 );
m_presenterViewEnabled = configGroup.readEntry<bool>( "PresenterViewEnabled", false );
}
}
示例3: applyCanvasConfiguration
void applyCanvasConfiguration(KarbonCanvas * canvas, KarbonPart * part)
{
KSharedConfigPtr config = part->componentData().config();
uint grabSensitivity = 3;
uint handleRadius = 3;
if (config->hasGroup("Misc")) {
KConfigGroup miscGroup = config->group("Misc");
grabSensitivity = miscGroup.readEntry("GrabSensitivity", grabSensitivity);
handleRadius = miscGroup.readEntry("HandleRadius", handleRadius);
}
canvas->resourceManager()->setHandleRadius(handleRadius);
canvas->resourceManager()->setGrabSensitivity(grabSensitivity);
QColor color(Qt::white);
if (config->hasGroup("Interface")) {
color = config->group("Interface").readEntry("CanvasColor", color);
}
canvas->setBackgroundColor(color);
}
示例4: loadPreviewConfig
bool KPrAnimationSelectorWidget::loadPreviewConfig()
{
KSharedConfigPtr config = KPrFactory::componentData().config();
bool showPreview = true;
if (config->hasGroup("Interface")) {
const KConfigGroup interface = config->group("Interface");
showPreview = interface.readEntry("ShowAutomaticPreviewAnimationEditDocker", showPreview);
}
return showPreview;
}
示例5: configChanged
void Interface::configChanged()
{
KSharedConfigPtr config = KGlobal::config();
QString group( confg_interface );
group += mIfaceName;
KConfigGroup interfaceGroup( config, group );
InterfaceSettings s;
mSettings.alias = interfaceGroup.readEntry( conf_alias ).trimmed();
mSettings.iconTheme = interfaceGroup.readEntry( conf_iconTheme, s.iconTheme );
QStringList themeNames;
QList<KNemoTheme> themes = findThemes();
// Let's check that it's available
foreach( KNemoTheme theme, themes )
themeNames << theme.internalName;
themeNames << NETLOAD_THEME;
if ( !themeNames.contains( mSettings.iconTheme ) )
mSettings.iconTheme = TEXT_THEME;
mSettings.colorIncoming = interfaceGroup.readEntry( conf_colorIncoming, s.colorIncoming );
mSettings.colorOutgoing = interfaceGroup.readEntry( conf_colorOutgoing, s.colorOutgoing );
KColorScheme scheme(QPalette::Active, KColorScheme::View);
mSettings.colorDisabled = interfaceGroup.readEntry( conf_colorDisabled, scheme.foreground( KColorScheme::InactiveText ).color() );
mSettings.colorUnavailable = interfaceGroup.readEntry( conf_colorUnavailable, scheme.foreground( KColorScheme::InactiveText ).color() );
mSettings.colorBackground = scheme.foreground( KColorScheme::InactiveText ).color();
mSettings.iconFont = interfaceGroup.readEntry( conf_iconFont, s.iconFont );
mSettings.dynamicColor = interfaceGroup.readEntry( conf_dynamicColor, s.dynamicColor );
mSettings.colorIncomingMax = interfaceGroup.readEntry( conf_colorIncomingMax, s.colorIncomingMax );
mSettings.colorOutgoingMax = interfaceGroup.readEntry( conf_colorOutgoingMax, s.colorOutgoingMax );
mSettings.barScale = interfaceGroup.readEntry( conf_barScale, s.barScale );
mSettings.inMaxRate = interfaceGroup.readEntry( conf_inMaxRate, s.inMaxRate )*1024;
mSettings.outMaxRate = interfaceGroup.readEntry( conf_outMaxRate, s.outMaxRate )*1024;
mSettings.hideWhenDisconnected = interfaceGroup.readEntry( conf_hideWhenNotAvail, s.hideWhenDisconnected );
mSettings.hideWhenUnavailable = interfaceGroup.readEntry( conf_hideWhenNotExist, s.hideWhenUnavailable );
mSettings.activateStatistics = interfaceGroup.readEntry( conf_activateStatistics, s.activateStatistics );
mSettings.trafficThreshold = clamp<unsigned int>(interfaceGroup.readEntry( conf_trafficThreshold, s.trafficThreshold ), 0, 1000 );
mSettings.warnRules.clear();
int warnRuleCount = interfaceGroup.readEntry( conf_warnRules, 0 );
for ( int i = 0; i < warnRuleCount; ++i )
{
group = QString( "%1%2 #%3" ).arg( confg_warnRule ).arg( mIfaceName ).arg( i );
if ( config->hasGroup( group ) )
{
KConfigGroup warnGroup( config, group );
WarnRule warn;
warn.periodUnits = clamp<int>(warnGroup.readEntry( conf_warnPeriodUnits, warn.periodUnits ), KNemoStats::Hour, KNemoStats::Year );
warn.periodCount = clamp<int>(warnGroup.readEntry( conf_warnPeriodCount, warn.periodUnits ), 1, 1000 );
warn.trafficType = clamp<int>(warnGroup.readEntry( conf_warnTrafficType, warn.trafficType ), KNemoStats::Peak, KNemoStats::PeakOffpeak );
warn.trafficDirection = clamp<int>(warnGroup.readEntry( conf_warnTrafficDirection, warn.trafficDirection ), KNemoStats::TrafficIn, KNemoStats::TrafficTotal );
warn.trafficUnits = clamp<int>(warnGroup.readEntry( conf_warnTrafficUnits, warn.trafficUnits ), KNemoStats::UnitB, KNemoStats::UnitG );
warn.threshold = clamp<double>(warnGroup.readEntry( conf_warnThreshold, warn.threshold ), 0.0, 9999.0 );
warn.customText = warnGroup.readEntry( conf_warnCustomText, warn.customText ).trimmed();
mSettings.warnRules << warn;
}
}
if ( interfaceGroup.hasKey( conf_calendar ) )
{
QString oldSetting = interfaceGroup.readEntry( conf_calendar );
mSettings.calendarSystem = KCalendarSystem::calendarSystem( oldSetting );
interfaceGroup.writeEntry( conf_calendarSystem, static_cast<int>(mSettings.calendarSystem) );
interfaceGroup.deleteEntry( conf_calendar );
config->sync();
}
else
mSettings.calendarSystem = static_cast<KLocale::CalendarSystem>(interfaceGroup.readEntry( conf_calendarSystem, static_cast<int>(KLocale::QDateCalendar) ));
mSettings.statsRules.clear();
int statsRuleCount = interfaceGroup.readEntry( conf_statsRules, 0 );
KCalendarSystem *testCal = KCalendarSystem::create( mSettings.calendarSystem );
for ( int i = 0; i < statsRuleCount; ++i )
{
group = QString( "%1%2 #%3" ).arg( confg_statsRule ).arg( mIfaceName ).arg( i );
if ( config->hasGroup( group ) )
{
KConfigGroup statsGroup( config, group );
StatsRule rule;
rule.startDate = statsGroup.readEntry( conf_statsStartDate, QDate() );
rule.periodUnits = clamp<int>(statsGroup.readEntry( conf_statsPeriodUnits, rule.periodUnits ), KNemoStats::Day, KNemoStats::Year );
rule.periodCount = clamp<int>(statsGroup.readEntry( conf_statsPeriodCount, rule.periodCount ), 1, 1000 );
rule.logOffpeak = statsGroup.readEntry( conf_logOffpeak,rule.logOffpeak );
rule.offpeakStartTime = QTime::fromString( statsGroup.readEntry( conf_offpeakStartTime, rule.offpeakStartTime.toString( Qt::ISODate ) ), Qt::ISODate );
rule.offpeakEndTime = QTime::fromString( statsGroup.readEntry( conf_offpeakEndTime, rule.offpeakEndTime.toString( Qt::ISODate ) ), Qt::ISODate );
rule.weekendIsOffpeak = statsGroup.readEntry( conf_weekendIsOffpeak, rule.weekendIsOffpeak );
rule.weekendDayStart = clamp<int>(statsGroup.readEntry( conf_weekendDayStart, rule.weekendDayStart ), 1, testCal->daysInWeek( QDate::currentDate() ) );
rule.weekendDayEnd = clamp<int>(statsGroup.readEntry( conf_weekendDayEnd, rule.weekendDayEnd ), 1, testCal->daysInWeek( QDate::currentDate() ) );
rule.weekendTimeStart = QTime::fromString( statsGroup.readEntry( conf_weekendTimeStart, rule.weekendTimeStart.toString( Qt::ISODate ) ), Qt::ISODate );
rule.weekendTimeEnd = QTime::fromString( statsGroup.readEntry( conf_weekendTimeEnd, rule.weekendTimeEnd.toString( Qt::ISODate ) ), Qt::ISODate );
if ( rule.isValid( testCal ) )
{
mSettings.statsRules << rule;
}
}
}
mSettings.commands.clear();
int numCommands = interfaceGroup.readEntry( conf_numCommands, s.numCommands );
for ( int i = 0; i < numCommands; i++ )
{
QString entry;
//.........这里部分代码省略.........