本文整理汇总了C++中KConfig::setFileWriteMode方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfig::setFileWriteMode方法的具体用法?C++ KConfig::setFileWriteMode怎么用?C++ KConfig::setFileWriteMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::setFileWriteMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveOptions
void TvConfig::saveOptions()
{
int card, tuner, pll, radio = 0;
KConfig *config = new KConfig("kcmtasmatvrc");
QFile bttv("/etc/modules.d/bttv");
card = getCard();
tuner = getTuner();
pll = pllGroup->id(pllGroup->selected());
if (radioCard->isChecked())
radio = 1;
if (bttv.open(IO_WriteOnly | IO_Truncate)) {
QTextStream os(&bttv);
config->setFileWriteMode(0644);
config->setGroup("System");
config->writeEntry("Card", card);
config->writeEntry("Tuner", tuner);
config->writeEntry("Pll", pll);
config->writeEntry("Radio", radio);
config->sync();
os << "### This file is automatically generated by tasma." << endl;
os << "#" << endl;
os << "# Please do not edit this file directly. All changes" << endl;
os << "# made in this file will be lost." << endl;
os << "#" << endl;
os << endl;
os << "options bttv card=" << card;
if (tuner != AUTO_TUNER)
os << " " << "tuner=" << tuner;
if (pll)
os << " " << "pll=" << pll;
if (radio)
os << " " << "radio=" << radio;
os << endl;
bttv.close();
system("/sbin/modules-update");
}
delete config;
}