void ICCSettingsContainer::writeToConfig(KConfigGroup& group) const { group.writeEntry("EnableCM", enableCM); if (!enableCM) { return; // No need to write settings in this case. } group.writeEntry("DefaultMismatchBehavior", (int)defaultMismatchBehavior); group.writeEntry("DefaultMissingProfileBehavior", (int)defaultMissingProfileBehavior); group.writeEntry("DefaultUncalibratedBehavior", (int)defaultUncalibratedBehavior); group.writeEntry("LastMismatchBehavior", (int)lastMismatchBehavior); group.writeEntry("LastMissingProfileBehavior", (int)lastMissingProfileBehavior); group.writeEntry("LastUncalibratedBehavior", (int)lastUncalibratedBehavior); group.writeEntry("LastSpecifiedAssignProfile", lastSpecifiedAssignProfile); group.writeEntry("LastSpecifiedInputProfile", lastSpecifiedInputProfile); group.writeEntry("BPCAlgorithm", useBPC); group.writeEntry("ManagedView", useManagedView); group.writeEntry("ManagedPreviews", useManagedPreviews); group.writeEntry("RenderingIntent", renderingIntent); group.writePathEntry("WorkProfileFile", workspaceProfile); group.writePathEntry("MonitorProfileFile", monitorProfile); group.writePathEntry("InProfileFile", defaultInputProfile); group.writePathEntry("ProofProfileFile", defaultProofProfile); group.writeEntry("ProofingRenderingIntent", proofingRenderingIntent); group.writeEntry("DoGamutCheck", doGamutCheck); group.writeEntry("GamutCheckMaskColor", gamutCheckMaskColor); group.writeEntry("DefaultPath", iccFolder); }
void saveEntries( const KConfigGroup &grp) { KConfigGroup cg = grp; if (cg.name().isEmpty()) { cg = KConfigGroup(cg.config(),"RecentFiles"); } cg.deleteGroup(); // write file list for (int i = 1; i <= recentFilesIndex.size(); ++i) { // i - 1 because we started from 1 cg.writePathEntry(QString("File%1").arg(i), recentFiles[i - 1]); cg.writePathEntry(QString("Name%1").arg(i), recentFilesIndex[i - 1]); } }
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( "p**n" ), 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
void ResourceNet::writeConfig( KConfigGroup &group ) { Resource::writeConfig( group ); group.writePathEntry( "NetUrl", mUrl.url() ); group.writeEntry( "NetFormat", mFormatName ); }
void ExportManager::setSaveLocation(const QString &savePath) { KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("spectaclerc")); KConfigGroup generalConfig = KConfigGroup(config, "General"); generalConfig.writePathEntry("last-saved-to", savePath); }
void TestRegressionWindow::setKHTMLDirectory() { m_khtmlUrl = KFileDialog::getExistingDirectory(); if(!m_khtmlUrl.isEmpty()) { const char *subdirs[] = { "css", "dom", "xml", "html" }; // That's enough ;-) for(int i = 0; i <= 3; i++) { QFileInfo sourceDir(m_khtmlUrl.path() + "/" + subdirs[i]); //krazy:exclude=duoblequote_chars DOM demands chars if(!sourceDir.exists() || !sourceDir.isDir()) { KMessageBox::error(0, i18n("Please choose a valid 'khtml/' build directory.")); m_khtmlUrl = KUrl(); break; } } // Remember directory... KConfig config("testregressiongui", KConfig::SimpleConfig); KConfigGroup grp = config.group("<default>"); grp.writePathEntry("KHTMLDirectory", m_khtmlUrl.path()); if(!m_testsUrl.isEmpty() && !m_khtmlUrl.isEmpty()) m_ui.actionRun_tests->setEnabled(true); } }
void KTimerJob::save( KConfig *cfg, const QString& grp ) { KConfigGroup groupcfg = cfg->group(grp); groupcfg.writeEntry( "Delay", d->delay ); groupcfg.writePathEntry( "Command", d->command ); groupcfg.writeEntry( "Loop", d->loop ); groupcfg.writeEntry( "OneInstance", d->oneInstance ); groupcfg.writeEntry( "State", (int)d->state ); }
void KompareShell::saveProperties(KConfigGroup &config) { // The 'config' object points to the session managed // config file. Anything you write here will be available // later when this app is restored if ( m_mode == Kompare::ComparingFiles ) { config.writeEntry( "Mode", "ComparingFiles" ); config.writePathEntry( "SourceUrl", m_sourceURL.url() ); config.writePathEntry( "DestinationUrl", m_destinationURL.url() ); } else if ( m_mode == Kompare::ShowingDiff ) { config.writeEntry( "Mode", "ShowingDiff" ); config.writePathEntry( "DiffUrl", m_diffURL.url() ); } viewPart()->saveProperties( config.config() ); }
void Workspace::saveProperties( KConfigGroup& cfg ) { QStringList list; for(int i =0; i< mSheetList.size(); i++) if ( !mSheetList.at(i)->fileName().isEmpty() ) list.append( mSheetList.at(i)->fileName() ); cfg.writePathEntry( "SelectedSheets", list ); cfg.writeEntry( "currentSheet", currentIndex() ); }
void CervisiaShell::saveProperties(KConfigGroup & config) { // Save current working directory (if part was created) if( m_part ) { config.writePathEntry("Current Directory", m_part->url().path()); // write to disk config.sync(); } }
void BasicTab::apply() { if (_menuEntryInfo) { _menuEntryInfo->setDirty(); _menuEntryInfo->setCaption(_nameEdit->text()); _menuEntryInfo->setDescription(_descriptionEdit->text()); _menuEntryInfo->setIcon(_iconButton->icon()); KDesktopFile *df = _menuEntryInfo->desktopFile(); KConfigGroup dg = df->desktopGroup(); dg.writeEntry("Comment", _commentEdit->text()); if (_systrayCB->isChecked()) dg.writeEntry("Exec", _execEdit->lineEdit()->text().prepend("ksystraycmd ")); else dg.writeEntry("Exec", _execEdit->lineEdit()->text()); dg.writePathEntry("Path", _pathEdit->lineEdit()->text()); if (_terminalCB->isChecked()) dg.writeEntry("Terminal", 1); else dg.writeEntry("Terminal", 0); dg.writeEntry("TerminalOptions", _termOptEdit->text()); dg.writeEntry("X-KDE-SubstituteUID", _uidCB->isChecked()); dg.writeEntry("X-KDE-Username", _uidEdit->text()); dg.writeEntry("StartupNotify", _launchCB->isChecked()); dg.writeEntry( "NoDisplay", _hiddenEntryCB->isChecked() ); QStringList onlyShowIn = df->desktopGroup().readXdgListEntry("OnlyShowIn"); /* the exact semantics of this checkbox are unclear if there is more than just KDE in the list... * For example: - The list is "Gnome;", the user enables "Only show in KDE" - should we remove Gnome? * - The list is "Gnome;KDE;", the user unchecks the box - should we keep Gnome? */ if ( _onlyShowInKdeCB->isChecked() && !onlyShowIn.contains("KDE")) onlyShowIn << "KDE"; else if ( !_onlyShowInKdeCB->isChecked() && onlyShowIn.contains("KDE")) onlyShowIn.removeAll("KDE"); if (onlyShowIn.isEmpty()) dg.deleteEntry("OnlyShowIn"); else dg.writeXdgListEntry("OnlyShowIn", onlyShowIn); } else { _menuFolderInfo->setCaption(_nameEdit->text()); _menuFolderInfo->setGenericName(_descriptionEdit->text()); _menuFolderInfo->setComment(_commentEdit->text()); _menuFolderInfo->setIcon(_iconButton->icon()); } }
// only saves the cache for the given list of items to prevent the cache // from growing forever. void KonqPixmapProvider::save( KConfigGroup& kc, const QString& key, const QStringList& items ) { QStringList list; QStringList::const_iterator itEnd = items.end(); for (QStringList::const_iterator it = items.begin(); it != itEnd; ++it) { QMap<KUrl,QString>::const_iterator mit = iconMap.constFind( KUrl(*it) ); if ( mit != iconMap.constEnd() ) { list.append( mit.key().url() ); list.append( mit.value() ); } } kc.writePathEntry( key, list ); }
void K3b::ImageWritingDialog::saveSettings( KConfigGroup c ) { d->writingModeWidget->saveConfig( c ), c.writeEntry( "simulate", d->checkDummy->isChecked() ); c.writeEntry( "multisession", d->checkNoFix->isChecked() ); c.writeEntry( "on_the_fly", !d->checkCacheImage->isChecked() ); d->dataModeWidget->saveConfig(c); c.writeEntry( "verify_data", d->checkVerify->isChecked() ); d->writerSelectionWidget->saveConfig( c ); c.writePathEntry( "image path", d->imagePath() ); c.writeEntry( "copies", d->spinCopies->value() ); QString imageType; if( d->comboImageType->currentIndex() == 0 ) imageType = "auto"; else { switch( d->imageTypeSelectionMap[d->comboImageType->currentIndex()] ) { case IMAGE_ISO: imageType = "iso9660"; break; case IMAGE_CUE_BIN: imageType = "cue-bin"; break; case IMAGE_AUDIO_CUE: imageType = "audio-cue"; break; case IMAGE_CDRECORD_CLONE: imageType = "cdrecord-clone"; break; case IMAGE_CDRDAO_TOC: imageType = "cdrdao-toc"; break; } } c.writeEntry( "image type", imageType ); if( d->tempDirSelectionWidget->isEnabled() ) d->tempDirSelectionWidget->saveConfig(); }
QString ExportManager::saveLocation() const { KSharedConfigPtr config = KSharedConfig::openConfig(QStringLiteral("spectaclerc")); KConfigGroup generalConfig = KConfigGroup(config, "General"); QString savePath = generalConfig.readPathEntry( "default-save-location", QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)); if (savePath.isEmpty() || savePath.isNull()) { savePath = QDir::homePath(); } savePath = QDir::cleanPath(savePath); QDir savePathDir(savePath); if (!(savePathDir.exists())) { savePathDir.mkpath(QStringLiteral(".")); generalConfig.writePathEntry("last-saved-to", savePath); } return savePath; }
/** * This function used to write configured rules to a given \c KConfigGroup. * It happens on `kate` start and on sanitize rules export. * * \param grp a group to write rules to * * \todo Use smth more human readable to export sanitize rules? XML? */ void PluginConfiguration::writeSanitizeRulesTo(KConfigGroup& grp) { // Transform sanitize rules into a serializable list of strings QStringList rules; for (auto&& rule : sanitizeRules()) { auto r = rule.first.pattern(); if (!rule.first.isValid()) // Ignore invalid regular expressions { kWarning() << "Ignore invalid sanitize regex: " << r; continue; } if (r.isEmpty()) // Ignore rules w/ empty find part { kWarning() << "Ignore invalid sanitize rule: " << rule.second; continue; } if (!rule.second.isEmpty()) r += SANITIZE_RULE_SEPARATOR + rule.second; rules << r; } grp.writePathEntry(SANITIZE_RULES_ITEM, rules); }
void KPBinaryIface::writeConfig() { KConfig config("kipirc"); KConfigGroup group = config.group(m_configGroup); group.writePathEntry(QString("%1Binary").arg(m_binaryBaseName), m_pathDir); }
void HistoryCollection::save(KConfigGroup &configgroup) { configgroup.writePathEntry("backHistory", m_b->m_list); configgroup.writePathEntry("forwardHistory", m_f->m_list); }
void MainWindow::saveProperties(KConfigGroup &group) { group.writePathEntry(QLatin1String("CurrentUrl"), m_currentUrl.url()); }
void KAResourceLocal::writeConfig(KConfigGroup& group) { group.writePathEntry("CalendarURL", mURL.prettyUrl()); AlarmResource::writeConfig(group); }
void ServiceButton::saveConfig( KConfigGroup& config ) const { config.writePathEntry("StorageId", _id ); if (!config.hasKey("DesktopFile") && _service) config.writePathEntry("DesktopFile", _service->desktopEntryPath()); }
//----------------------------------------------------------------------------- void KMAcctMaildir::writeConfig(KConfigGroup& config) { KMAccount::writeConfig(config); config.writePathEntry("Location", mLocation); }
void ResourceLocal::writeConfig( KConfigGroup &group ) { KRES::Resource::writeConfig( group ); group.writePathEntry( "NotesURL", mURL.prettyUrl() ); }
void KRecentDocument::add(const QUrl &url, const QString &desktopEntryName) { if (url.isLocalFile() && url.toLocalFile().startsWith(QDir::tempPath())) { return; // inside tmp resource, do not save } QString openStr = url.toDisplayString(); openStr.replace(QRegExp(QStringLiteral("\\$")), QStringLiteral("$$")); // Desktop files with type "Link" are $-variable expanded // qDebug() << "KRecentDocument::add for " << openStr; KConfigGroup config = KSharedConfig::openConfig()->group(QByteArray("RecentDocuments")); bool useRecent = config.readEntry(QStringLiteral("UseRecent"), true); int maxEntries = config.readEntry(QStringLiteral("MaxEntries"), 10); if (!useRecent || maxEntries <= 0) { return; } const QString path = recentDocumentDirectory(); const QString fileName = url.fileName(); // don't create a file called ".desktop", it will lead to an empty name in kio_recentdocuments const QString dStr = path + (fileName.isEmpty() ? QStringLiteral("unnamed") : fileName); QString ddesktop = dStr + QLatin1String(".desktop"); int i = 1; // check for duplicates while (QFile::exists(ddesktop)) { // see if it points to the same file and application KDesktopFile tmp(ddesktop); if (tmp.desktopGroup().readPathEntry("URL", QString()) == url.toDisplayString() && tmp.desktopGroup().readEntry("X-KDE-LastOpenedWith") == desktopEntryName) { // Set access and modification time to current time ::utime(QFile::encodeName(ddesktop).constData(), NULL); return; } // if not append a (num) to it ++i; if (i > maxEntries) { break; } ddesktop = dStr + QStringLiteral("[%1].desktop").arg(i); } QDir dir(path); // check for max entries, delete oldest files if exceeded const QStringList list = dir.entryList(QDir::Files | QDir::Hidden, QFlags<QDir::SortFlag>(QDir::Time | QDir::Reversed)); i = list.count(); if (i > maxEntries - 1) { QStringList::ConstIterator it; it = list.begin(); while (i > maxEntries - 1) { QFile::remove(dir.absolutePath() + QLatin1String("/") + (*it)); --i, ++it; } } // create the applnk KDesktopFile configFile(ddesktop); KConfigGroup conf = configFile.desktopGroup(); conf.writeEntry("Type", QStringLiteral("Link")); conf.writePathEntry("URL", openStr); // If you change the line below, change the test in the above loop conf.writeEntry("X-KDE-LastOpenedWith", desktopEntryName); conf.writeEntry("Name", url.fileName()); conf.writeEntry("Icon", KIO::iconNameForUrl(url)); }
void BrowserButton::saveConfig( KConfigGroup& config ) const { config.writeEntry("Icon", _icon); config.writePathEntry("Path", topMenu->path()); }
void TestRegressionWindow::initTestsDirectory() { bool okay = !m_testsUrl.isEmpty(); if(okay) { const char *subdirs[] = { "tests", "baseline", "output", "resources" }; for(int i = 0; i <= 3; i++) { QFileInfo sourceDir(m_testsUrl.path() + "/" + subdirs[i]); //krazy:exclude=duoblequote_chars DOM demands chars if(!sourceDir.exists() || !sourceDir.isDir()) { KMessageBox::error(0, i18n("Please choose a valid 'khtmltests/regression/' directory.")); okay = false; m_testsUrl = KUrl(); break; } } } if(okay) { // Clean up... m_itemMap.clear(); m_ignoreMap.clear(); m_failureMap.clear(); m_directoryMap.clear(); m_ui.treeWidget->clear(); if(!m_khtmlUrl.isEmpty()) m_ui.actionRun_tests->setEnabled(true); // Initialize map (to prevent assert below)... m_directoryMap.insert(QString(), QStringList()); // Setup root tree widget item... (void) new QTreeWidgetItem(m_ui.treeWidget, QStringList(m_testsUrl.path() + "/tests")); // Check for ignore & failure file in root directory... QString ignoreFile = m_testsUrl.path() + "/tests/ignore"; QString failureFile = m_testsUrl.path() + "/tests/KNOWN_FAILURES"; QStringList ignoreFileList = readListFile(ignoreFile); QStringList failureFileList = readListFile(failureFile); if(!ignoreFileList.isEmpty()) m_ignoreMap.insert(QString(), ignoreFileList); if(!failureFileList.isEmpty()) m_failureMap.insert(QString(), failureFileList); // Remember directory... KConfig config("testregressiongui", KConfig::SimpleConfig); KConfigGroup grp = config.group("<default>"); grp.writePathEntry("TestsDirectory", m_testsUrl.path()); // Start listing directory... KUrl listUrl = m_testsUrl; listUrl.addPath("tests"); KIO::ListJob *job = KIO::listRecursive(listUrl, KIO::HideProgressInfo, false /* no hidden files */); connect(job, SIGNAL(result(KJob *)), SLOT(directoryListingFinished(KJob *))); connect(job, SIGNAL(entries(KIO::Job *, const KIO::UDSEntryList &)), this, SLOT(directoryListingResult(KIO::Job *, const KIO::UDSEntryList &))); } }