Esempio n. 1
0
bool K3b::MiscOptionTab::saveSettings()
{
    KConfigGroup c = KGlobal::config()->group( "General Options" );

    c.writeEntry( "ask_for_saving_changes_on_exit", m_checkSaveOnExit->isChecked() );
    c.writeEntry( "Show splash", m_checkShowSplash->isChecked() );
    c.writeEntry( "Show progress OSD", m_checkShowProgressOSD->isChecked() );
    c.writeEntry( "hide main window while writing", m_checkHideMainWindowWhileWriting->isChecked() );
    c.writeEntry( "keep action dialogs open", m_checkKeepDialogsOpen->isChecked() );
    c.writeEntry( "check system config", m_checkSystemConfig->isChecked() );
    c.writeEntry( "action dialog startup settings", m_comboActionDialogSettings->selectedValue() );

    QString tempDir = m_editTempDir->url().toLocalFile();
    QFileInfo fi( tempDir );
    
    if( fi.isRelative() ) {
        fi.setFile( fi.absoluteFilePath() );
    }

    if( !fi.exists() ) {
        if( KMessageBox::questionYesNo( this,
                                        i18n("Folder (%1) does not exist. Create?",tempDir),
                                        i18n("Create Folder"),
                                        KGuiItem( i18n("Create") ),
                                        KStandardGuiItem::cancel() ) == KMessageBox::Yes ) {
            if( !KStandardDirs::makeDir( fi.absoluteFilePath() ) ) {
                KMessageBox::error( this, i18n("Unable to create folder %1",tempDir) );
                return false;
            }
        }
        else {
            // the dir does not exist and the user doesn't want to create it
            return false;
        }
    }

    if( fi.isFile() ) {
        KMessageBox::information( this, i18n("You specified a file for the temporary folder. "
                                             "K3b will use its base path as the temporary folder."),
                                  i18n("Warning"),
                                  "temp file only using base path" );
        fi.setFile( fi.path() );
    }

    // check for writing permission
    if( !fi.isWritable() ) {
        KMessageBox::error( this, i18n("You do not have permission to write to %1.",fi.absoluteFilePath()) );
        return false;
    }
    

    m_editTempDir->setUrl( fi.absoluteFilePath() );

    k3bcore->globalSettings()->setDefaultTempPath( m_editTempDir->url().toLocalFile() );

//   if( m_radioMultipleInstancesSmart->isChecked() )
//     c.writeEntry( "Multiple Instances", "smart" );
//   else
//     c.writeEntry( "Multiple Instances", "always_new" );

    return true;
}
Esempio n. 2
0
void KSaveIOConfig::setProxyConfigScript( const QString& _url )
{
    KConfigGroup cfg (config(), "Proxy Settings");
    cfg.writeEntry("Proxy Config Script", _url);
    cfg.sync();
}
Esempio n. 3
0
void KSaveIOConfig::setConnectTimeout( int _timeout )
{
    KConfigGroup cfg (config(), QString());
    cfg.writeEntry("ConnectTimeout", qMax(MIN_TIMEOUT_VALUE,_timeout));
    cfg.sync();
}
Esempio n. 4
0
void KSaveIOConfig::setMaxCacheAge( int cache_age )
{
    KConfigGroup cfg (http_config(), QString());
    cfg.writeEntry( "MaxCacheAge", cache_age );
    cfg.sync();
}
Esempio n. 5
0
void KSaveIOConfig::setProxyType(KProtocolManager::ProxyType type)
{
    KConfigGroup cfg (config(), "Proxy Settings");
    cfg.writeEntry("ProxyType", static_cast<int>(type));
    cfg.sync();
}
Esempio n. 6
0
void KSaveIOConfig::setMarkPartial( bool _mode )
{
    KConfigGroup cfg (config(), QString());
    cfg.writeEntry( "MarkPartial", _mode );
    cfg.sync();
}
Esempio n. 7
0
void KSaveIOConfig::setAutoResume( bool _mode )
{
    KConfigGroup cfg (config(), QString());
    cfg.writeEntry( "AutoResume", _mode );
    cfg.sync();
}
Esempio n. 8
0
void Autocorrect::writeConfig()
{
    KConfigGroup interface = KoGlobal::kofficeConfig()->group("Autocorrect");
    interface.writeEntry("enabled", m_enabled->isChecked());
    interface.writeEntry("UppercaseFirstCharOfSentence", m_uppercaseFirstCharOfSentence);
    interface.writeEntry("FixTwoUppercaseChars", m_fixTwoUppercaseChars);
    interface.writeEntry("AutoFormatURLs", m_autoFormatURLs);
    interface.writeEntry("SingleSpaces", m_singleSpaces);
    interface.writeEntry("TrimParagraphs", m_trimParagraphs);
    interface.writeEntry("AutoBoldUnderline", m_autoBoldUnderline);
    interface.writeEntry("AutoFractions", m_autoFractions);
    interface.writeEntry("AutoNumbering", m_autoNumbering);
    interface.writeEntry("SuperscriptAppendix", m_superscriptAppendix);
    interface.writeEntry("CapitalizeWeekDays", m_capitalizeWeekDays);
    interface.writeEntry("AutoFormatBulletList", m_autoFormatBulletList);
    interface.writeEntry("AdvancedAutocorrect", m_advancedAutocorrect);

    interface.writeEntry("ReplaceDoubleQuotes", m_replaceDoubleQuotes);
    interface.writeEntry("ReplaceSingleQuotes", m_replaceSingleQuotes);

    interface.writeEntry("formatLanguage", m_autocorrectLang);
}
Esempio n. 9
0
void IdealDockWidget::contextMenuRequested(const QPoint &point)
{
    QWidget* senderWidget = qobject_cast<QWidget*>(sender());
    Q_ASSERT(senderWidget);

    QMenu menu;
    menu.addSection(windowIcon(), windowTitle());

    QList< QAction* > viewActions = m_view->contextMenuActions();
    if(!viewActions.isEmpty()) {
        menu.addActions(viewActions);
        menu.addSeparator();
    }

    ///TODO: can this be cleaned up?
    if(QToolBar* toolBar = widget()->findChild<QToolBar*>()) {
        menu.addAction(toolBar->toggleViewAction());
        menu.addSeparator();
    }

    /// start position menu
    QMenu* positionMenu = menu.addMenu(i18n("Toolview Position"));

    QActionGroup *g = new QActionGroup(this);

    QAction *left = new QAction(i18nc("toolview position", "Left"), g);
    QAction *bottom = new QAction(i18nc("toolview position", "Bottom"), g);
    QAction *right = new QAction(i18nc("toolview position", "Right"), g);
    QAction *detach = new QAction(i18nc("toolview position", "Detached"), g);

    for (auto action : {left, bottom, right, detach}) {
        positionMenu->addAction(action);
        action->setCheckable(true);
    }
    if (isFloating()) {
        detach->setChecked(true);
    } else if (m_docking_area == Qt::BottomDockWidgetArea)
        bottom->setChecked(true);
    else if (m_docking_area == Qt::LeftDockWidgetArea)
        left->setChecked(true);
    else if (m_docking_area == Qt::RightDockWidgetArea)
        right->setChecked(true);
    /// end position menu

    menu.addSeparator();

    QAction *setShortcut = menu.addAction(QIcon::fromTheme(QStringLiteral("configure-shortcuts")), i18n("Assign Shortcut..."));
    setShortcut->setToolTip(i18n("Use this shortcut to trigger visibility of the toolview."));

    menu.addSeparator();
    QAction* remove = menu.addAction(QIcon::fromTheme(QStringLiteral("dialog-close")), i18n("Remove Toolview"));

    QAction* triggered = menu.exec(senderWidget->mapToGlobal(point));

    if (triggered)
    {
        if ( triggered == remove ) {
            slotRemove();
            return;
        } else if ( triggered == setShortcut ) {
            QDialog* dialog(new QDialog(this));
            dialog->setWindowTitle(i18n("Assign Shortcut For '%1' Tool View", m_view->document()->title()));
            KShortcutWidget *w = new KShortcutWidget(dialog);
            w->setShortcut(m_controller->actionForView(m_view)->shortcuts());
            QVBoxLayout* dialogLayout = new QVBoxLayout(dialog);
            dialogLayout->addWidget(w);
            QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
            dialogLayout->addWidget(buttonBox);
            connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept);
            connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject);

            if (dialog->exec() == QDialog::Accepted) {
                m_controller->actionForView(m_view)->setShortcuts(w->shortcut());

                //save shortcut config
                KConfigGroup config = KSharedConfig::openConfig()->group("UI");
                QStringList shortcuts;
                shortcuts << w->shortcut().value(0).toString();
                shortcuts << w->shortcut().value(1).toString();
                config.writeEntry(QStringLiteral("Shortcut for %1").arg(m_view->document()->title()), shortcuts);
                config.sync();
            }
            delete dialog;

            return;
        } else if ( triggered == detach ) {
            setFloating(true);
            m_area->raiseToolView(m_view);
            return;
        }

        if (isFloating()) {
            setFloating(false);
        }

        Sublime::Position pos;
        if (triggered == left)
            pos = Sublime::Left;
        else if (triggered == bottom)
            pos = Sublime::Bottom;
        else if (triggered == right)
            pos = Sublime::Right;
        else
            return;

        Area *area = m_area;
        View *view = m_view;
        /* This call will delete *this, so we no longer
           can access member variables. */
        m_area->moveToolView(m_view, pos);
        area->raiseToolView(view);
    }
}
Esempio n. 10
0
 void ChunkDownloadView::saveState(KSharedConfigPtr cfg)
 {
     KConfigGroup g = cfg->group("ChunkDownloadView");
     QByteArray s = m_chunk_view->header()->saveState();
     g.writeEntry("state", s.toBase64());
 }
Esempio n. 11
0
void WPEditAccount::writeConfig()
{
	KConfigGroup group = KGlobal::config()->group("WinPopup");
	group.writeEntry("SmbcPath", mSmbcPath->url().toLocalFile());
	group.writeEntry("HostCheckFreq", mHostCheckFreq->text());
}
Esempio n. 12
0
 void WebSeedsTab::saveState(KSharedConfigPtr cfg)
 {
     KConfigGroup g = cfg->group("WebSeedsTab");
     QByteArray s = m_webseed_list->header()->saveState();
     g.writeEntry("state", s.toBase64());
 }
Esempio n. 13
0
void RestorationTool::writeSettings()
{
    GreycstorationContainer prm = d->settingsWidget->settings();
    KSharedConfig::Ptr config   = KGlobal::config();
    KConfigGroup group          = config->group(d->configGroupName);

    group.writeEntry(d->configPresetEntry,        d->restorationTypeCB->currentIndex());
    group.writeEntry(d->configFastApproxEntry,    prm.fastApprox);
    group.writeEntry(d->configInterpolationEntry, prm.interp);
    group.writeEntry(d->configAmplitudeEntry,     (double)prm.amplitude);
    group.writeEntry(d->configSharpnessEntry,     (double)prm.sharpness);
    group.writeEntry(d->configAnisotropyEntry,    (double)prm.anisotropy);
    group.writeEntry(d->configAlphaEntry,         (double)prm.alpha);
    group.writeEntry(d->configSigmaEntry,         (double)prm.sigma);
    group.writeEntry(d->configGaussPrecEntry,     (double)prm.gaussPrec);
    group.writeEntry(d->configDlEntry,            (double)prm.dl);
    group.writeEntry(d->configDaEntry,            (double)prm.da);
    group.writeEntry(d->configIterationEntry,     prm.nbIter);
    group.writeEntry(d->configTileEntry,          prm.tile);
    group.writeEntry(d->configBTileEntry,         prm.btile);
    group.sync();
}
Esempio n. 14
0
void ScriptingSettings::saveSettings(KConfigGroup& group)
{
    group.writeEntry("Script", d->script->text());
}
Esempio n. 15
0
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);
}
Esempio n. 16
0
void SettingsCore::saveSettings()
{
#ifdef ABAKUS_QTONLY
    //TODO
#else
    KConfigGroup config = KGlobal::config()->group("Settings");
    
    config.writeEntry("Trigonometric mode",
                      trigMode() == Abakus::Degrees
                      ? "Degrees"
                      : "Radians");
    
    config.writeEntry("Decimal Precision", Abakus::m_prec);
    config.writeEntry("History Limit", m_historyLimit);
    
    
    config = KGlobal::config()->group("GUI");
    
    config.writeEntry("InCompactMode", m_compactMode);
    
    config.writeEntry("ShowMathematicalSidebar", m_mathematicalSidebarVisible);
    
    config.writeEntry("MathematicalSidebarActiveTab", m_mathematicalSidebarActiveView);
    config.writeEntry("MathematicalSidebarWidth", m_mathematicalSidebarWidth);
    
    config.writeEntry("Size", m_windowSize);
    
    
    config = KGlobal::config()->group("Variables");
    config.deleteGroup();
    
    QStringList saveList;
    QStringList::ConstIterator it;
    int fieldWidth;
    int numberOfEntries;
    
    // Set precision to max for most accuracy
    Abakus::m_prec = 75;
    
    
    QStringList values = NumeralModel::instance()->valueNames();
    for(it = values.begin(), numberOfEntries = 0; it != values.end(); ++it) {
        if(NumeralModel::instance()->isValueReadOnly(*it))
            continue;
        
        ++numberOfEntries;
    }
    fieldWidth = QString("%1").arg(numberOfEntries).length();
    int j = 0;
    for(it = values.begin(); it != values.end(); ++it) {
        if(NumeralModel::instance()->isValueReadOnly(*it))
            continue;
        
        saveList.clear();
        saveList << *it;
        saveList << NumeralModel::instance()->value(*it).toString(Abakus::DEC);
        saveList << QString("%1").arg(NumeralModel::instance()->value(*it).numeralSystem());
        config.writeEntry(QString("%1").arg(j, fieldWidth, 10, QLatin1Char('0')), saveList);
        ++j;
    }
    
    
    config = KGlobal::config()->group("Functions");
    config.deleteGroup();
    
    FunctionModel *manager = FunctionModel::instance();
    UnaryFunction *fn;
    QString variable;
    QString expression;
    QString saveString;
    QStringList userFunctions = manager->functionList(FunctionModel::UserDefined);
    fieldWidth = QString("%1").arg(userFunctions.count()).length();
    j = 0;
    foreach(QString functionName, userFunctions)
    {
        fn = dynamic_cast<UnaryFunction *>(manager->function(functionName)->userFn->fn);
        variable = manager->function(functionName)->userFn->varName;
        expression = fn->operand()->infixString();
        
        saveString = QString("%1(%2) = %3").arg(functionName).arg(variable).arg(expression);
        config.writeEntry(QString("%1").arg(j, fieldWidth, 10, QLatin1Char('0')), saveString);
        ++j;
    }
Esempio n. 17
0
void    MassifConfigPage::saveToConfiguration(KConfigGroup cfg, KDevelop::IProject *) const
{
    cfg.writeEntry("Massif Arguments", ui->massifParameters->text());
    cfg.writeEntry("launchVisualizer", ui->launchMassifVisualizer->isChecked());
    cfg.writeEntry("visualizerExecutable", ui->massifVisualizerExecutable->text());
    cfg.writeEntry("depth", ui->depth->value());
    cfg.writeEntry("threshold", ui->threshold->value());
    cfg.writeEntry("peakInaccuracy", ui->peakInaccuracy->value());
    cfg.writeEntry("maxSnapshots", ui->maxSnapshots->value());
    cfg.writeEntry("snapshotsFreq", ui->snapshotFreq->value());
    cfg.writeEntry("timeUnit", ui->timeUnit->currentIndex());
    cfg.writeEntry("profileHeap", ui->profileHeap->isChecked());
    cfg.writeEntry("profileStack", ui->profileStack->isChecked());
}
Esempio n. 18
0
void SettingsWidget::saveSettings(KConfigGroup& group)
{
    d->settingsExpander->writeSettings(group);

    group.writeEntry("Custom Date",                   d->useCustDateInput->dateTime());
    group.writeEntry("Custom Time",                   d->useCustTimeInput->dateTime());

    group.writeEntry("Adjustment Type",               d->adjTypeChooser->currentIndex());
    group.writeEntry("Adjustment Days",               d->adjDaysInput->value());
    group.writeEntry("Adjustment Time",               d->adjTimeInput->dateTime());

    TimeAdjustSettings prm = settings();

    group.writeEntry("Update Application Time",       prm.updAppDate);
    group.writeEntry("Update File Modification Time", prm.updFileModDate);
    group.writeEntry("Update EXIF Modification Time", prm.updEXIFModDate);
    group.writeEntry("Update EXIF Original Time",     prm.updEXIFOriDate);
    group.writeEntry("Update EXIF Digitization Time", prm.updEXIFDigDate);
    group.writeEntry("Update EXIF Thumbnail Time",    prm.updEXIFThmDate);
    group.writeEntry("Update IPTC Time",              prm.updIPTCDate);
    group.writeEntry("Update XMP Creation Time",      prm.updXMPDate);
    group.writeEntry("Update File Name",              prm.updFileName);

    group.writeEntry("Use Timestamp Type",            prm.dateSource);
    group.writeEntry("Meta Timestamp Type",           prm.metadataSource);
    group.writeEntry("File Timestamp Type",           prm.fileDateSource);
}
Esempio n. 19
0
void KSaveIOConfig::setMinimumKeepSize( int _size )
{
    KConfigGroup cfg (config(), QString());
    cfg.writeEntry( "MinimumKeepSize", _size );
    cfg.sync();
}
Esempio n. 20
0
void FreeRotationSettings::writeSettings(KConfigGroup& group)
{
    FreeRotationContainer prm = settings();
    group.writeEntry(d->configAutoCropTypeEntry, d->autoCropCB->currentIndex());
    group.writeEntry(d->configAntiAliasingEntry, d->antialiasInput->isChecked());
}
Esempio n. 21
0
void KSaveIOConfig::setUseCache( bool _mode )
{
    KConfigGroup cfg (http_config(), QString());
    cfg.writeEntry( "UseCache", _mode );
    cfg.sync();
}
void TaskEditor::saveAsCompleted() {
    KConfigGroup cg = m_service->operationDescription("setCompleted");
    cg.writeEntry("completed", true);
    emit jobStarted(m_service->startOperationCall(cg));
}
Esempio n. 23
0
void KSaveIOConfig::setUseReverseProxy( bool mode )
{
    KConfigGroup cfg (config(), "Proxy Settings");
    cfg.writeEntry("ReversedException", mode);
    cfg.sync();
}
Esempio n. 24
0
void process(Mode mode, KConfigGroup &grp, QString key, QString value)
{
    switch (mode) {
    case Read:
        if (IS_A_TTY(1))
            std::cout << CHAR(key) << ": " << CHAR(grp.readEntry(key, "does not exist")) << " (" << CHAR(path(grp)) << ")" << std::endl;
        else
            std::cout << CHAR(grp.readEntry(key, ""));
        break;
    case Write: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        bool added = !grp.hasKey(key);
        QString oldv;
        if (!added) oldv = grp.readEntry(key);
        grp.writeEntry(key, QString(value));
        grp.sync();
        if (added)
            std::cout << "New " << CHAR(key) << ": " << CHAR(grp.readEntry(key)) << std::endl;
        else
            std::cout << CHAR(key) << ": " << CHAR(oldv) << " -> " << CHAR(grp.readEntry(key)) << std::endl;
        break;
    }
    case Delete: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        if (grp.hasKey(key)) {
            std::cout << "Removed " << CHAR(key) << ": " << CHAR(grp.readEntry(key)) << std::endl;
            grp.deleteEntry(key);
            grp.sync();
        } else if (grp.hasGroup(key)) {
            std::cout << "There's a group, but no key: " << CHAR(key) << "\nPlease explicitly use deletegroup" << std::endl;
            exit(1);
        } else {
            std::cout << "There's no key " << CHAR(key) << " in " << CHAR(path(grp)) << std::endl;
            exit(1);
        }
        break;
    }
    case DeleteGroup: {
        if (grp.hasGroup(key)) {
            grp = grp.group(key);
            if (grp.isImmutable()) {
                std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
                exit(1);
            }
            QMap<QString, QString> map = grp.entryMap();
            std::cout << "Removed " << CHAR(key) << gs_separator << std::endl;
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                std::cout << CHAR(it.key()) << ": " << CHAR(it.value()) << std::endl;
            }
            grp.deleteGroup();
            grp.sync();
        } else {
            std::cout << "There's no group " << CHAR(key) << " in " << CHAR(path(grp)) << std::endl;
            exit(1);
        }
        break;
    }
    case List:
    case ListKeys: {
        if (!grp.exists()) { // could be parent group
            if (mode == ListKeys)
                exit(1);
            QStringList groups = grp.parent().exists() ? grp.parent().groupList() : grp.config()->groupList();
            if (groups.isEmpty()) {
                std::cout << "The component/group " << CHAR(path(grp)) << " does not exist" << std::endl;
                exit(1);
            }
            std::cout << "Groups in " << CHAR(path(grp)) << gs_separator << std::endl;
            foreach (const QString &s, groups)
                if (key.isEmpty() || s.contains(key, Qt::CaseInsensitive))
                    std::cout << CHAR(s) << std::endl;
            exit(0);
        }

        QMap<QString, QString> map = grp.entryMap();
        if (map.isEmpty()) {
            std::cout << "The group " << CHAR(path(grp)) << " is empty" << std::endl;
            break;
        }

        if (mode == List) {
            bool matchFound = false;
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                if (key.isEmpty() || it.key().contains(key, Qt::CaseInsensitive)) {
                    if (!matchFound)
                        std::cout << std::endl << CHAR(path(grp)) << gs_separator << std::endl;
                    matchFound = true;
                    std::cout << CHAR(it.key()) << ": " << CHAR(it.value()) << std::endl;
                }
            }

            if (!matchFound)
                std::cout << "No present key matches \"" << CHAR(key) << "\" in " << CHAR(path(grp));
            std::cout << std::endl;
        } else {
            for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
                if (key.isEmpty() || it.key().contains(key, Qt::CaseInsensitive)) {
                    std::cout << CHAR(it.key()) << std::endl;
                }
            }
        }
        break;
    }
    case ListGroups: {
        QStringList groups = grp.parent().exists() ? grp.parent().groupList() : grp.config()->groupList();
        foreach (const QString &s, groups)
            if (key.isEmpty() || s.contains(key, Qt::CaseInsensitive))
                std::cout << CHAR(s) << std::endl;
        exit(0);
    }
    case Replace: {
        if (grp.isImmutable()) {
            std::cout << "The component/group " << CHAR(path(grp)) << " cannot be modified" << std::endl;
            exit(1);
        }
        QStringList match = key.split("=");
        if (match.count() != 2) {
            std::cout << "The match sequence must be of the form <key regexp>=<value regexp>" << std::endl;
            exit(1);
        }
        QRegExp keyMatch(match.at(0), Qt::CaseInsensitive);
        QRegExp valueMatch(match.at(1), Qt::CaseInsensitive);
        QStringList replace = value.split("=");
        if (replace.count() != 2) {
            std::cout << "The replace sequence must be of the form <key string>=<value string>" << std::endl;
            exit(1);
        }
        QMap<QString, QString> map = grp.entryMap();
        QStringList keys;
        for (QMap<QString, QString>::const_iterator it = map.constBegin(), end = map.constEnd(); it != end; ++it) {
            if (keyMatch.exactMatch(it.key()) && valueMatch.exactMatch(it.value())) {
                keys << it.key();
            }
        }
        foreach (const QString &key, keys) {
            QString newKey = key;
            newKey.replace(keyMatch, replace.at(0));
            QString newValue = grp.readEntry(key);
            const QString oldValue = newValue;
            newValue.replace(valueMatch, replace.at(1));
            if (key != newKey)
                grp.deleteEntry(key);
            grp.writeEntry(newKey, newValue);
            std::cout << CHAR(key) << ": " << CHAR(oldValue) << " -> " << CHAR(newKey) << ": " << CHAR(grp.readEntry(newKey)) << std::endl;
            grp.sync();
        }
        break;
    }
    Invalid:
    default:
        break;
    }
Esempio n. 25
0
void KSaveIOConfig::setNoProxyFor( const QString& _noproxy )
{
    KConfigGroup cfg (config(), "Proxy Settings");
    cfg.writeEntry("NoProxyFor", _noproxy);
    cfg.sync();
}
Esempio n. 26
0
void WeatherWallpaper::save(KConfigGroup & config)
{
    QString oldSource(m_source);
    int oldInterval = m_weatherUpdateTime;

    if (m_configWidget) {
        m_source = m_configWidget->source();
        m_weatherUpdateTime = m_configWidget->updateInterval();
    }
    if (m_source != oldSource || m_weatherUpdateTime != oldInterval) {
        if (!oldSource.isEmpty()) {
            weatherEngine->disconnectSource(oldSource, this);
        }
        if (!m_source.isEmpty()) {
            connectWeatherSource();
        }
    }
    config.writeEntry("source", m_source);
    config.writeEntry("updateWeather", m_weatherUpdateTime);
    config.writeEntry("wallpaperposition", (int)m_resizeMethod);
    config.writeEntry("wallpapercolor", m_color);
    config.writeEntry("userswallpapers", m_usersWallpapers);
    // Save custom wallpaper/weather pairings
    config.writeEntry("clearPaper", m_weatherMap[QLatin1String( "weather-clear" )]);
    config.writeEntry("partlyCloudyPaper", m_weatherMap[QLatin1String( "weather-few-clouds" )]);
    config.writeEntry("cloudyPaper", m_weatherMap[QLatin1String( "weather-clouds" )]);
    config.writeEntry("manyCloudsPaper", m_weatherMap[QLatin1String( "weather-many-clouds" )]);
    config.writeEntry("showersPaper", m_weatherMap[QLatin1String( "weather-showers" )]);
    config.writeEntry("showersScatteredPaper", m_weatherMap[QLatin1String( "weather-showers-scattered" )]);
    config.writeEntry("rainPaper", m_weatherMap[QLatin1String( "weather-rain" )]);
    config.writeEntry("mistPaper", m_weatherMap[QLatin1String( "weather-mist" )]);
    config.writeEntry("stormPaper", m_weatherMap[QLatin1String( "weather-storm" )]);
    config.writeEntry("hailPaper", m_weatherMap[QLatin1String( "weather-hail" )]);
    config.writeEntry("snowPaper", m_weatherMap[QLatin1String( "weather-snow" )]);
    config.writeEntry("snowScatteredPaper", m_weatherMap[QLatin1String( "weather-snow-scattered" )]);
    config.writeEntry("partlyCloudyNightPaper", m_weatherMap[QLatin1String( "weather-few-clouds-night" )]);
    config.writeEntry("cloudyNightPaper", m_weatherMap[QLatin1String( "weather-clouds-night" )]);
    config.writeEntry("clearNightPaper", m_weatherMap[QLatin1String( "weather-clear-night" )]);
    config.writeEntry("freezingRainPaper", m_weatherMap[QLatin1String( "weather-freezing-rain" )]);
    config.writeEntry("snowRainPaper", m_weatherMap[QLatin1String( "weather-snow-rain" )]);
}
Esempio n. 27
0
void KSaveIOConfig::setProxyDisplayUrlFlags (int flags)
{
    KConfigGroup cfg (config(), QString());
    cfg.writeEntry("ProxyUrlDisplayFlags", flags);
    cfg.sync();
}
Esempio n. 28
0
void Action::cfg_write( KConfigGroup& cfg_P ) const
    {
    cfg_P.writeEntry( "Type", "ERROR" ); // derived classes should call with their type
    }
Esempio n. 29
0
 void ScriptingModule::writeConfigEntryBool(const QString& group, const QString& name, bool value)
 {
     KConfigGroup g = KSharedConfig::openConfig()->group(group);
     g.writeEntry(name, value);
 }
Esempio n. 30
0
void ModelsManager::save(const GroupsName& g)
{
    KConfigGroup group = m_config.group(g.name());
    group.writeEntry("format", static_cast<int>(m_controller->formats(g).first()));
    group.writeEntry("mode", static_cast<int>(m_controller->modes(g).first()));
}