本文整理汇总了C++中KConfig::writePathEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfig::writePathEntry方法的具体用法?C++ KConfig::writePathEntry怎么用?C++ KConfig::writePathEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::writePathEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveSettings
void KPrinter::saveSettings()
{
if (d->m_impl)
{
setOption("kde-searchname", searchName());
d->m_impl->saveOptions(d->m_options);
}
// save latest used printer to config file
KConfig *conf = KGlobal::config();
conf->setGroup("KPrinter Settings");
conf->writeEntry("Printer",searchName());
// latest used print command
conf->writePathEntry("PrintCommand",option("kde-printcommand"));
// latest used document directory
if ( d->m_docdirectory.isEmpty() )
{
KURL url( outputFileName() );
if ( url.isValid() )
conf->writePathEntry( "DocDirectory", url.directory() );
}
else
conf->writePathEntry( "DocDirectory", d->m_docdirectory );
}
示例2: saveContainerConfig
void DockBarExtension::saveContainerConfig()
{
QStringList applet_list;
KConfig *conf = config();
unsigned count = 0;
for(DockContainer::Vector::const_iterator it = containers.constBegin(); it != containers.constEnd(); ++it)
{
DockContainer *c = *it;
if(!c->command().isEmpty())
{
QString applet_gid = QString("Applet_%1").arg(QString::number(count));
applet_list.append(applet_gid);
conf->setGroup(applet_gid);
conf->writePathEntry("Command", c->command());
conf->writePathEntry("resName", c->resName());
conf->writeEntry("resClass", c->resClass());
++count;
}
}
conf->setGroup("General");
conf->writeEntry("Applets", applet_list);
conf->deleteEntry("Commands"); // cleanup old config
conf->sync();
}
示例3: acceptGlobalSettingsPage
void KDevIDEExtension::acceptGlobalSettingsPage(KDialogBase *dlg)
{
KConfig* config = kapp->config();
config->setGroup("General Options");
config->writeEntry("DesignerApp", gsw->designerButtonGroup->selectedId());
config->writeEntry("Read Last Project On Startup",gsw->lastProjectCheckbox->isChecked());
config->writePathEntry("DefaultProjectsDir", gsw->projectsURL->url());
config->writeEntry("OutputViewFont", gsw->outputFont->font());
QString DesignerSetting;
if ( gsw->qtDesignerRadioButton->isChecked() ) DesignerSetting = "ExternalDesigner";
if ( gsw->seperateAppRadioButton->isChecked() ) DesignerSetting = "ExternalKDevDesigner";
if ( gsw->embeddedDesignerRadioButton->isChecked() ) DesignerSetting = "EmbeddedKDevDesigner";
config->writeEntry( "DesignerSetting", DesignerSetting );
config->setGroup("MakeOutputView");
config->writeEntry("LineWrapping",gsw->lineWrappingCheckBox->isChecked());
config->writeEntry("ShowDirNavigMsg",gsw->dirNavigMsgCheckBox->isChecked());
config->writeEntry( "ForceCLocale", gsw->forceCLocaleRadio->isChecked() );
//current item id must be in sync with the enum!
config->writeEntry("CompilerOutputLevel",gsw->compileOutputCombo->currentItem());
config->sync();
if( KDevPlugin *makeExt = API::getInstance()->pluginController()->extension("KDevelop/MakeFrontend"))
{
static_cast<KDevMakeFrontend*>(makeExt)->updateSettingsFromConfig();
}
config->setGroup("TerminalEmulator");
config->writeEntry("UseKDESetting", gsw->useKDETerminal->isChecked() );
config->writeEntry("TerminalApplication", gsw->terminalEdit->text().stripWhiteSpace() );
}
示例4: setCalendar
/******************************************************************************
* Set the calendar file URL for a specified application.
*/
void ADConfigData::setCalendar(const QCString &appName, ADCalendar *cal)
{
KConfig *config = KGlobal::config();
config->setGroup(CLIENT_GROUP + QString::fromLocal8Bit(appName));
config->writePathEntry(CALENDAR_KEY, cal->urlString());
config->sync();
}
示例5: selectBackground
/**
* Select a background image.
*/
void KJezzball::selectBackground()
{
QString path = KFileDialog::getExistingDirectory( m_backgroundDir, this,
i18n("Select Background Image Folder") );
if ( !path.isEmpty() && path!=m_backgroundDir ) {
m_backgroundDir = path;
// enable action
m_backgroundShowAction->setEnabled(true);
// save settings
KConfig *config = kapp->config();
config->writePathEntry( "BackgroundDir", m_backgroundDir );
config->sync();
// apply background setting
if ( m_showBackground ) {
if ( m_background.width()==0 )
m_background = getBackgroundPixmap();
m_gameWidget->setBackground( m_background );
}
else{
KMessageBox::information( this, i18n("You may now turn on background images."));
}
}
}
示例6: changeDir
void SFileDialog::changeDir( const QString& f )
{
if ( !f.isEmpty() ){
KConfig* config = kapp->config();
config->setGroup( QString("SFileDialogData:") + name() );
config->writePathEntry( "InitiallyDir", f );
}
}
示例7: writeClient
/******************************************************************************
* Write a client application's details to the config file.
*/
void ADConfigData::writeClient(const QCString &appName, const ClientInfo *cinfo)
{
KConfig *config = KGlobal::config();
config->setGroup(CLIENT_GROUP + QString::fromLocal8Bit(appName));
config->writeEntry(TITLE_KEY, cinfo->title());
config->writeEntry(DCOP_OBJECT_KEY, QString::fromLocal8Bit(cinfo->dcopObject()));
config->writeEntry(START_CLIENT_KEY, cinfo->startClient());
config->writePathEntry(CALENDAR_KEY, cinfo->calendar()->urlString());
config->sync();
}
示例8: writeAppSetting
void EditorChooser::writeAppSetting(const QString &postfix)
{
KConfig *cfg = kapp->config();
QString previousGroup = cfg->group();
cfg->setGroup("KTEXTEDITOR:" + postfix);
cfg->writeEntry("DEVELOPER_INFO", "NEVER TRY TO USE VALUES FROM THAT GROUP, THEY ARE SUBJECT TO CHANGES");
cfg->writePathEntry("editor", (d->chooser->editorCombo->currentItem() == 0) ? QString::null
: (*d->elements.at(d->chooser->editorCombo->currentItem() - 1)));
cfg->sync();
cfg->setGroup(previousGroup);
}
示例9: main
int main(int argc, char **argv)
{
KAboutData aboutData("kwriteconfig", I18N_NOOP("KWriteConfig"), "1.0.0", I18N_NOOP("Write KConfig entries - for use in shell scripts"),
KAboutData::License_GPL, "(c) 2001 Red Hat, Inc. & Luís Pedro Coelho");
aboutData.addAuthor("Luís Pedro Coelho", 0, "[email protected]");
aboutData.addAuthor("Bernhard Rosenkraenzer", "Wrote kreadconfig on which this is based", "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
QString group = QString::fromLocal8Bit(args->getOption("group"));
QString key = QString::fromLocal8Bit(args->getOption("key"));
QString file = QString::fromLocal8Bit(args->getOption("file"));
QCString type = args->getOption("type").lower();
if(key.isNull() || !args->count())
{
KCmdLineArgs::usage();
return 1;
}
QCString value = args->arg(0);
KInstance inst(&aboutData);
KConfig *konfig;
if(file.isEmpty())
konfig = new KConfig(QString::fromLatin1("kdeglobals"), false, false);
else
konfig = new KConfig(file, false, false);
konfig->setGroup(group);
if(konfig->getConfigState() != KConfig::ReadWrite || konfig->entryIsImmutable(key))
return 2;
if(type == "bool")
{
// For symmetry with kreadconfig we accept a wider range of values as true than Qt
bool boolvalue = (value == "true" || value == "on" || value == "yes" || value == "1");
konfig->writeEntry(key, boolvalue);
}
else if(type == "path")
{
konfig->writePathEntry(key, QString::fromLocal8Bit(value));
}
else
{
konfig->writeEntry(key, QString::fromLocal8Bit(value));
}
konfig->sync();
delete konfig;
return 0;
}
示例10: add
void KRecentDirs::add(const QString &fileClass, const QString &directory)
{
QString key = fileClass;
QStringList result;
KConfig *config = recentdirs_readList(key, result, false);
// make sure the dir is first in history
result.remove(directory);
result.prepend(directory);
while(result.count() > MAX_DIR_HISTORY)
result.remove(result.fromLast());
config->writePathEntry(key, result);
recentdirs_done(config);
}
示例11: save
void CfgComponent::save(KConfig *cfg)
{
// yes, this can happen if there are NO KTrader offers for this component
if(!m_lookupDict[ComponentSelector->currentText()])
return;
QString ServiceTypeToConfigure = cfg->readEntry("ServiceTypeToConfigure");
KConfig *store = new KConfig(cfg->readPathEntry("storeInFile", "null"));
store->setGroup(cfg->readEntry("valueSection"));
store->writePathEntry(cfg->readEntry("valueName", "kcm_componenchooser_null"), *m_lookupDict[ComponentSelector->currentText()]);
store->sync();
delete store;
emit changed(false);
}
示例12: saveSettings
void KuickShow::saveSettings()
{
KConfig *kc = KGlobal::config();
kc->setGroup("SessionSettings");
if ( oneWindowAction )
kc->writeEntry( "OpenImagesInActiveWindow", oneWindowAction->isChecked() );
if ( fileWidget ) {
kc->writePathEntry( "CurrentDirectory", fileWidget->url().prettyURL() ); // ### was url().url()
fileWidget->writeConfig( kc, "Filebrowser" );
}
kc->sync();
}
示例13: queryClose
bool Core::queryClose()
{
// save the the project to open it automaticly on startup if needed
KConfig* config = kapp->config();
config->setGroup("General Options");
config->writePathEntry("Last Project",ProjectManager::getInstance()->projectFile().url());
if ( !PartController::getInstance()->querySaveFiles() )
return false;
if ( !ProjectManager::getInstance()->closeProject( true ) )
return false;
if ( !PartController::getInstance()->readyToClose() )
return false;
return true;
}
示例14: storeGroup
void ToolsConfigWidget::storeGroup(const QString &group, const QDict<ToolsConfigEntry> &entryDict)
{
KConfig *config = ToolsFactory::instance()->config();
QStringList list;
QDictIterator<ToolsConfigEntry> it(entryDict);
for (; it.current(); ++it) {
ToolsConfigEntry *entry = it.current();
list << entry->menutext;
config->setGroup(group + " " + entry->menutext);
config->writePathEntry("CommandLine", entry->cmdline);
config->writeEntry("DesktopFile", entry->isdesktopfile);
config->writeEntry("Captured", entry->captured);
}
config->setGroup("External Tools");
config->writeEntry(group, list);
}
示例15: setWallpaper
void Wallpaper::setWallpaper()
{
// KDesktop settings...
// - Wallpaper is scaled
KConfig *config = new KConfig("kdesktoprc");
config->setGroup("Desktop0");
config->writeEntry("WallpaperMode", "Scaled");
config->writePathEntry("Wallpaper", selectedPaper);
// Same wallpaper for alls desktops
config->setGroup("Background Common");
config->writeEntry("CommonDesktop", true);
config->sync();
delete config;
// call dcop
DCOPRef wall("kdesktop", "KBackgroundIface");
DCOPReply reply = wall.call("setWallpaper", selectedPaper, 6);
}