本文整理汇总了C++中KConfigGroup::readPathEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup::readPathEntry方法的具体用法?C++ KConfigGroup::readPathEntry怎么用?C++ KConfigGroup::readPathEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfigGroup
的用法示例。
在下文中一共展示了KConfigGroup::readPathEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readProperties
void KompareShell::readProperties(const KConfigGroup &config)
{
// The 'config' object points to the session managed
// config file. This function is automatically called whenever
// the app is being restored. Read in here whatever you wrote
// in 'saveProperties'
QString mode = config.readEntry( "Mode", "ComparingFiles" );
if ( mode == "ComparingFiles" )
{
m_mode = Kompare::ComparingFiles;
m_sourceURL = config.readPathEntry( "SourceUrl", "" );
m_destinationURL = config.readPathEntry( "DestinationFile", "" );
viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
viewPart()->compareFiles( m_sourceURL, m_destinationURL );
}
else if ( mode == "ShowingDiff" )
{
m_mode = Kompare::ShowingDiff;
m_diffURL = config.readPathEntry( "DiffUrl", "" );
viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
m_viewPart->openUrl( m_diffURL );
}
else
{ // just in case something weird has happened, don't restore the diff then
// Bruggie: or when some idiot like me changes the possible values for mode
// IOW, a nice candidate for a kconf_update thingy :)
viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
}
}
示例2: readFromConfig
void ICCSettingsContainer::readFromConfig(KConfigGroup& group)
{
enableCM = group.readEntry("EnableCM", true);
//if (!group.hasKey("OnProfileMismatch") && group.hasKey("BehaviourICC")) // legacy
// behavior = group.readEntry("BehaviourICC", false) ? "convert" : "ask";
QString sRGB = IccProfile::sRGB().filePath();
workspaceProfile = group.readPathEntry("WorkProfileFile", sRGB);
monitorProfile = group.readPathEntry("MonitorProfileFile", sRGB);
defaultInputProfile = group.readPathEntry("InProfileFile", QString());
defaultProofProfile = group.readPathEntry("ProofProfileFile", QString());
defaultMismatchBehavior = (Behavior)group.readEntry("DefaultMismatchBehavior", (int)EmbeddedToWorkspace);
defaultMissingProfileBehavior = (Behavior)group.readEntry("DefaultMissingProfileBehavior", (int)SRGBToWorkspace);
defaultUncalibratedBehavior = (Behavior)group.readEntry("DefaultUncalibratedBehavior", (int)AutoToWorkspace);
lastMismatchBehavior = (Behavior)group.readEntry("LastMismatchBehavior", (int)EmbeddedToWorkspace);
lastMissingProfileBehavior = (Behavior)group.readEntry("LastMissingProfileBehavior", (int)SRGBToWorkspace);
lastUncalibratedBehavior = (Behavior)group.readEntry("LastUncalibratedBehavior", (int)AutoToWorkspace);
lastSpecifiedAssignProfile = group.readEntry("LastSpecifiedAssignProfile", sRGB);
lastSpecifiedInputProfile = group.readEntry("LastSpecifiedInputProfile", defaultInputProfile);
useBPC = group.readEntry("BPCAlgorithm", true);
useManagedView = group.readEntry("ManagedView", true);
useManagedPreviews = group.readEntry("ManagedPreviews", true);
renderingIntent = group.readEntry("RenderingIntent", (int)IccTransform::Perceptual);
proofingRenderingIntent = group.readEntry("ProofingRenderingIntent", (int)IccTransform::AbsoluteColorimetric);
doGamutCheck = group.readEntry("DoGamutCheck", false);
gamutCheckMaskColor = group.readEntry("GamutCheckMaskColor", QColor(126, 255, 255));
iccFolder = group.readEntry("DefaultPath", QString());
}
示例3: loadEntries
void loadEntries(const KConfigGroup &grp)
{
recentFiles.clear();
recentFilesIndex.clear();
QString value;
QString nameValue;
QUrl url;
KConfigGroup cg = grp;
if ( cg.name().isEmpty()) {
cg = KConfigGroup(cg.config(),"RecentFiles");
}
// read file list
for (int i = 1; i <= maxItems; i++) {
value = cg.readPathEntry(QString("File%1").arg(i), QString());
if (value.isEmpty()) continue;
url = QUrl(value);
// gemini only handles local files
// yes, i know the second half here isn't good on windows... but without it we fail on linux, and second part for windows
if (!url.isLocalFile() && !value.startsWith('/') && value.midRef(2, 1) != QLatin1String(":")) {
qDebug() << "Not a local file:" << url;
continue;
}
// Don't restore if file doesn't exist anymore
if (!QFile::exists(url.toLocalFile()) && !QFile::exists(value)) {
qDebug() << "Recent file apparently no longer exists:" << url.toLocalFile();
continue;
}
value = QDir::toNativeSeparators( value );
// Don't restore where the url is already known (eg. broken config)
if (recentFiles.contains(value))
continue;
nameValue = cg.readPathEntry(QString("Name%1").arg(i), url.fileName());
if (!value.isNull()) {
recentFilesIndex << nameValue;
recentFiles << value;
}
}
}
示例4: AlarmResource
KAResourceLocal::KAResourceLocal(const KConfigGroup& group)
: AlarmResource(group),
mFileReadOnly(false)
{
mURL = KUrl(group.readPathEntry("CalendarURL", QString()));
init();
}
示例5: read
bool SaverConfig::read(const QString &file)
{
KDesktopFile config(file);
const KConfigGroup group = config.desktopGroup();
#if 0
if( !config.tryExec())
return false;
#endif
mExec = group.readPathEntry("Exec", QString());
mName = group.readEntry("Name");
QString categoryName = group.readEntry("X-KDE-Category");
if(categoryName.isEmpty())
mCategory = categoryName;
else
mCategory = i18nc("Screen saver category", // Must be same in CMakeFiles.txt
categoryName.toUtf8());
if (config.hasActionGroup("Setup"))
{
mSetup = config.actionGroup("Setup").readPathEntry("Exec", QString());
}
if (config.hasActionGroup("InWindow"))
{
mSaver = config.actionGroup("InWindow").readPathEntry("Exec", QString());
}
int indx = file.lastIndexOf('/');
if (indx >= 0) {
mFile = file.mid(indx+1);
}
return !mSaver.isEmpty();
}
示例6: KPageWidgetItem
RecentProjectsDialogPage::RecentProjectsDialogPage()
: KPageWidgetItem( new QWidget(), i18n( "Recent Projects" ) ),
d( new RecentProjectsDialogPagePrivate( this ) )
{
setIcon( KIcon( "document-open-recent" ) );
d->widget = new QListWidget( widget() );
connect( d->widget, SIGNAL( doubleClicked( QModelIndex ) ),
SLOT( projectDoubleClicked( QModelIndex ) ) );
QVBoxLayout* layout = new QVBoxLayout( widget() );
widget()->setLayout( layout );
layout->addWidget( d->widget );
const KConfigGroup group = KGlobal::config()->group( "Recent Files" );
const int entryCount = ( group.entryMap().count() / 2 );
for( int i = entryCount; i >= 1; --i )
{
const QString key = QString( "File%1" ).arg( i );
const QString path = group.readPathEntry( key, QString() );
QListWidgetItem* item = new QListWidgetItem;
item->setIcon( KIcon( "document-open-recent" ) );
QString projectName = KUrl( path ).directory().split( '/' ).last();
item->setText( QString( "%1\n%2" ).arg( projectName ).arg( path ) );
item->setData( Qt::UserRole, path );
d->widget->addItem( item );
}
}
示例7: load
void CfgBrowser::load(KConfig *)
{
const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General") );
const QString exec = config.readPathEntry( QStringLiteral("BrowserApplication"), QString() );
if (exec.isEmpty())
{
radioKIO->setChecked(true);
m_browserExec = exec;
m_browserService = 0;
}
else
{
radioExec->setChecked(true);
if (exec.startsWith('!'))
{
m_browserExec = exec.mid(1);
m_browserService = 0;
}
else
{
m_browserService = KService::serviceByStorageId( exec );
if (m_browserService)
m_browserExec = m_browserService->desktopEntryName();
else
m_browserExec.clear();
}
}
lineExec->setText(m_browserExec);
emit changed(false);
}
示例8: engineMediaChanged
void MainWindow::engineMediaChanged(Phonon::MediaSource /*newSource*/)
{
m_audioView->update();
// update recently played list
qDebug() << " update recent files list ";
emit fileChanged( engine()->urlOrDisc() );
//TODO fetch this from the Media source
QUrl const &url = TheStream::url();
const QString url_string = url.url();
#ifndef NO_SKIP_PR0N
// ;-)
if( !(url_string.contains( QLatin1String( "porn" ), Qt::CaseInsensitive )
|| url_string.contains( QLatin1String( "pr0n" ), Qt::CaseInsensitive )) ) {
#endif
if( url.scheme() != QLatin1String( "dvd" ) && url.scheme() != QLatin1String( "vcd" ) && !url.toDisplayString().isEmpty()) {
KConfigGroup config = KConfigGroup( KSharedConfig::openConfig(), "General" );
const QString prettyUrl = url.toDisplayString();
QStringList urls = config.readPathEntry( "Recent Urls", QStringList() );
urls.removeAll( prettyUrl );
config.writePathEntry( "Recent Urls", urls << prettyUrl );
emit m_loadView->reloadRecentlyList();
}
#ifndef NO_SKIP_PR0N
}
#endif
}//engineMediaChanged
示例9: Resource
ResourceNet::ResourceNet( const KConfigGroup &group )
: Resource( group ), mFormat( 0 ),
mTempFile( 0 ),
d( new ResourceNetPrivate )
{
init( KUrl( group.readPathEntry( "NetUrl", QString() ) ), group.readEntry( "NetFormat" ) );
}
示例10: readSanitizeRulesFrom
/**
* \param grp group to read rules
* \param need_clear should all current rule must be removed before
*/
void PluginConfiguration::readSanitizeRulesFrom(const KConfigGroup& grp, const bool need_clear)
{
if (need_clear)
m_sanitize_rules.clear();
// Read sanitize rules from serializable form
auto rules = grp.readPathEntry(SANITIZE_RULES_ITEM, QStringList{});
for (auto&& rule : rules)
{
auto l = rule.split(SANITIZE_RULE_SEPARATOR);
auto find = QString{};
auto replace = QString{};
switch (l.size())
{
case 2:
replace.swap(l[1]);
case 1:
find.swap(l[0]);
break;
default:
kWarning() << "Invalid sanitize rule ignored: " << rule;
}
kDebug(DEBUG_AREA) << "Got sanitize rule: find =" << find << ", replace =" << replace;
if (!find.isEmpty())
{
auto find_regex = QRegExp{find};
if (find_regex.isValid())
m_sanitize_rules.emplace_back(std::move(find_regex), std::move(replace));
else
kWarning() << "Invalid sanitize rule ignored: " << rule;
}
}
}
示例11: load
void CfgComponent::load(KConfig *cfg) {
ComponentSelector->clear();
m_lookupDict.clear();
m_revLookupDict.clear();
const KConfigGroup mainGroup = cfg->group(QByteArray());
const QString serviceTypeToConfigure = mainGroup.readEntry("ServiceTypeToConfigure");
const KService::List offers = KServiceTypeTrader::self()->query(serviceTypeToConfigure);
for (KService::List::const_iterator tit = offers.begin(); tit != offers.end(); ++tit) {
ComponentSelector->addItem((*tit)->name());
m_lookupDict.insert((*tit)->name(), (*tit)->desktopEntryName());
m_revLookupDict.insert((*tit)->desktopEntryName(), (*tit)->name());
}
KConfig store(mainGroup.readPathEntry("storeInFile","null"));
const KConfigGroup group(&store, mainGroup.readEntry("valueSection"));
QString setting = group.readEntry(mainGroup.readEntry("valueName","kcm_componenchooser_null"), QString());
if (setting.isEmpty())
setting = mainGroup.readEntry("defaultImplementation", QString());
QString tmp = m_revLookupDict.value(setting);
if (!tmp.isEmpty()) {
for (int i=0;i<ComponentSelector->count();i++)
if (tmp==ComponentSelector->itemText(i))
{
ComponentSelector->setCurrentIndex(i);
break;
}
}
emit changed(false);
}
示例12: readSettings
void IccProfilesSettings::readSettings(KConfigGroup& group)
{
QStringList lastProfiles = group.readPathEntry(d->configRecentlyUsedProfilesEntry, QStringList());
foreach(const QString& path, lastProfiles)
{
d->favoriteProfiles.insert(path, new bool(true));
}
示例13: load
void KTimerJob::load( KConfig *cfg, const QString& grp )
{
KConfigGroup groupcfg = cfg->group(grp);
setDelay( groupcfg.readEntry( "Delay", 100 ) );
setCommand( groupcfg.readPathEntry( "Command", QString() ) );
setLoop( groupcfg.readEntry( "Loop", false ) );
setOneInstance( groupcfg.readEntry( "OneInstance", d->oneInstance ) );
setState( (States)groupcfg.readEntry( "State", (int)Stopped ) );
}
示例14: readProperties
void CervisiaShell::readProperties(const KConfigGroup& config)
{
m_lastOpenDir = config.readPathEntry("Current Directory", QString());
// if the session is restoring, make sure we open the URL
// since it's not handled by main()
if( kapp->isSessionRestored() )
openURL();
}
示例15: if
void K3b::ImageWritingDialog::loadSettings( const KConfigGroup& c )
{
d->writingModeWidget->loadConfig( c );
d->checkDummy->setChecked( c.readEntry("simulate", false ) );
d->checkNoFix->setChecked( c.readEntry("multisession", false ) );
d->checkCacheImage->setChecked( !c.readEntry("on_the_fly", true ) );
d->dataModeWidget->loadConfig(c);
d->spinCopies->setValue( c.readEntry( "copies", 1 ) );
d->checkVerify->setChecked( c.readEntry( "verify_data", false ) );
d->writerSelectionWidget->loadConfig( c );
if( !d->imageForced ) {
QString image = c.readPathEntry( "image path", c.readPathEntry( "last written image", QString() ) );
if( QFile::exists( image ) )
d->editImagePath->setUrl( image );
}
QString imageType = c.readEntry( "image type", "auto" );
int x = 0;
if( imageType == "iso9660" )
x = d->imageTypeSelectionMapRev[IMAGE_ISO];
else if( imageType == "cue-bin" )
x = d->imageTypeSelectionMapRev[IMAGE_CUE_BIN];
else if( imageType == "audio-cue" )
x = d->imageTypeSelectionMapRev[IMAGE_AUDIO_CUE];
else if( imageType == "cdrecord-clone" )
x = d->imageTypeSelectionMapRev[IMAGE_CDRECORD_CLONE];
else if( imageType == "cdrdao-toc" )
x = d->imageTypeSelectionMapRev[IMAGE_CDRDAO_TOC];
d->comboImageType->setCurrentIndex( x );
d->tempDirSelectionWidget->setTempPath( K3b::defaultTempPath() );
slotToggleAll();
}