本文整理汇总了C++中KSharedConfigPtr::copyTo方法的典型用法代码示例。如果您正苦于以下问题:C++ KSharedConfigPtr::copyTo方法的具体用法?C++ KSharedConfigPtr::copyTo怎么用?C++ KSharedConfigPtr::copyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KSharedConfigPtr
的用法示例。
在下文中一共展示了KSharedConfigPtr::copyTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: backupConfig
void ExportNotesJob::backupConfig()
{
setProgressDialogLabel(i18n("Backing up config..."));
const QString knotesStr(QStringLiteral("knotesrc"));
const QString knotesrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + knotesStr;
backupFile(knotesrc, Utils::configsPath(), knotesStr);
const QString globalNoteSettingsStr(QStringLiteral("globalnotesettings"));
const QString globalNoteSettingsrc = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + globalNoteSettingsStr;
if (QFile(globalNoteSettingsrc).exists()) {
KSharedConfigPtr globalnotesettingsrc = KSharedConfig::openConfig(globalNoteSettingsrc);
QTemporaryFile tmp;
tmp.open();
KConfig *knoteConfig = globalnotesettingsrc->copyTo(tmp.fileName());
const QString selectFolderNoteStr(QStringLiteral("SelectNoteFolder"));
if (knoteConfig->hasGroup(selectFolderNoteStr)) {
KConfigGroup selectFolderNoteGroup = knoteConfig->group(selectFolderNoteStr);
const QString selectFolderNoteGroupStr(QStringLiteral("DefaultFolder"));
Utils::convertCollectionIdsToRealPath(selectFolderNoteGroup, selectFolderNoteGroupStr);
}
knoteConfig->sync();
backupFile(tmp.fileName(), Utils::configsPath(), globalNoteSettingsStr);
delete knoteConfig;
}
backupUiRcFile(QStringLiteral("knotesappui.rc"), QStringLiteral("knotes"));
backupUiRcFile(QStringLiteral("knotesui.rc"), QStringLiteral("knotes"));
backupUiRcFile(QStringLiteral("knotes_part.rc"), QStringLiteral("knotes"));
backupConfigFile(QStringLiteral("akonadi_notes_agent.notifyrc"));
storeDirectory(QStringLiteral("/knotes/print/theme/"));
Q_EMIT info(i18n("Config backup done."));
}