static void process( QTreeView *tv, const KConfigGroup &config )
 {
   const QByteArray state = config.readEntry( tv->objectName(), QByteArray() );
   if ( !state.isEmpty() )
     tv->header()->restoreState( state );
 }
Esempio n. 2
0
int  PlasmaApp::newInstance()
{
    KCmdLineArgs* args = KCmdLineArgs::parsedArgs();

    if (args->count() == 0) {
        KCmdLineArgs::usage();
        return 0;
    }

    QString pluginName;
    if (args->count() > 0) {
        pluginName = args->arg(0);
    }

    //is the applet already running?
    if (m_viewForPlugin.contains(pluginName)) {
        m_viewForPlugin.value(pluginName)->activateWindow();
        m_viewForPlugin.value(pluginName)->raise();
        return 0;
    }

    QVariantList appletArgs;
    for (int i = 1; i < args->count(); ++i) {
        appletArgs << args->arg(i);
    }

    int appletId;
    Plasma::Containment *containment = m_corona->addContainment("null");
    containment->setFormFactor(Plasma::Planar);
    containment->setLocation(Plasma::Floating);
    appletId = ++m_maxId;

    if (m_storedApplets.contains(pluginName)) {
        int storedAppletId = m_storedApplets.values(pluginName).first();
        KConfigGroup config = storedConfig(storedAppletId);

        KConfigGroup actualConfig(containment->config());
        actualConfig = KConfigGroup(&actualConfig, "Applets");
        actualConfig = KConfigGroup(&actualConfig, QString::number(appletId));

        config.copyTo(&actualConfig);
        config.deleteGroup();
        m_storedApplets.remove(pluginName, storedAppletId);
    }

    SingleView *view = new SingleView(m_corona, containment, pluginName, appletId, appletArgs);

    if (!view->applet()) {
        delete view;
        return 0;
    }

    connect(view, SIGNAL(storeApplet(Plasma::Applet*)), this, SLOT(storeApplet(Plasma::Applet*)));
    connect(view, SIGNAL(destroyed(QObject*)), this, SLOT(viewDestroyed(QObject*)));

    if (args->isSet("border")) {
        view->setBackgroundBrush(KColorUtils::mix(Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor), Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor), 0.15));
        connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(themeChanged()));
        view->applet()->setBackgroundHints(Plasma::Applet::NoBackground);
    } else {
        view->setWindowFlags(Qt::FramelessWindowHint);
        view->setAttribute(Qt::WA_TranslucentBackground);
        view->setAutoFillBackground(false);
        view->viewport()->setAutoFillBackground(false);
        view->setAttribute(Qt::WA_NoSystemBackground);
        view->viewport()->setAttribute(Qt::WA_NoSystemBackground);
        Plasma::WindowEffects::overrideShadow(view->winId(), true);
    }

    if (args->isSet("fullscreen")) {
        view->setWindowState(Qt::WindowFullScreen);
    }

    args->clear();

    m_viewForPlugin[pluginName] = view;
    m_pluginForView[view] = pluginName;
    KWindowSystem::setOnDesktop(view->winId(), KWindowSystem::currentDesktop());
    view->show();
    view->raise();

    return 0;
}
void Area::save(KConfigGroup& group) const
{
    QStringList desired;
    QMap<QString, Sublime::Position>::iterator i, e;
    for (i = d->desiredToolViews.begin(), e = d->desiredToolViews.end(); i != e; ++i)
    {
        desired << i.key() + ':' + QString::number(static_cast<int>(i.value()));
    }
    group.writeEntry("desired views", desired);
    kDebug() << "save " << this << "wrote" << group.readEntry("desired views", "");
    group.writeEntry("view on left", shownToolView(Sublime::Left));
    group.writeEntry("view on right", shownToolView(Sublime::Right));
    group.writeEntry("view on top", shownToolView(Sublime::Top));
    group.writeEntry("view on bottom", shownToolView(Sublime::Bottom));
    group.writeEntry("thickness left", thickness(Sublime::Left));
    group.writeEntry("thickness right", thickness(Sublime::Right));
    group.writeEntry("thickness bottom", thickness(Sublime::Bottom));
    group.writeEntry("thickness top", thickness(Sublime::Top));
    group.writeEntry("working set", d->workingSet);
}
Esempio n. 4
0
int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    tryInitDrMingw();

#ifdef HAVE_IMAGE_MAGICK
    InitializeMagick(nullptr);
#endif

#ifdef Q_OS_LINUX
    app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif

    // if we have some local breeze icon resource, prefer it
    DXmlGuiWindow::setupIconTheme();

    KLocalizedString::setApplicationDomain("digikam");

    KAboutData aboutData(QLatin1String("digikam"), // component name
                         i18n("digiKam"),          // display name
                         digiKamVersion());

    aboutData.setShortDescription(QString::fromUtf8("%1 - %2").arg(DAboutData::digiKamSlogan()).arg(DAboutData::digiKamFamily()));
    aboutData.setLicense(KAboutLicense::GPL);
    aboutData.setCopyrightStatement(DAboutData::copyright());
    aboutData.setOtherText(additionalInformation());
    aboutData.setHomepage(DAboutData::webProjectUrl().url());

    DAboutData::authorsRegistration(aboutData);

    QCommandLineParser parser;
    KAboutData::setApplicationData(aboutData);
    parser.addVersionOption();
    parser.addHelpOption();
    aboutData.setupCommandLine(&parser);
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("download-from"),
                                        i18n("Open camera dialog at <path>"),
                                        QLatin1String("path")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("download-from-udi"),
                                        i18n("Open camera dialog for the device with Solid UDI <udi>"),
                                        QLatin1String("udi")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("detect-camera"),
                                        i18n("Automatically detect and open a connected gphoto2 camera")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("database-directory"),
                                        i18n("Start digikam with the SQLite database file found in the directory <dir>"),
                                        QLatin1String("dir")));
    parser.addOption(QCommandLineOption(QStringList() << QLatin1String("config"),
                                        i18n("Start digikam with the configuration file <config>"),
                                        QLatin1String("config")));

    parser.process(app);
    aboutData.processCommandLine(&parser);

    MetaEngine::initializeExiv2();

    // Force to use application icon for non plasma desktop as Unity for ex.
    QApplication::setWindowIcon(QIcon::fromTheme(QLatin1String("digikam"), app.windowIcon()));

    // Check if Qt database plugins are available.

    if (!QSqlDatabase::isDriverAvailable(DbEngineParameters::SQLiteDatabaseType()) &&
        !QSqlDatabase::isDriverAvailable(DbEngineParameters::MySQLDatabaseType()))
    {
        if (QSqlDatabase::drivers().isEmpty())
        {
            QMessageBox::critical(qApp->activeWindow(),
                                  qApp->applicationName(),
                                  i18n("Run-time Qt SQLite or MySQL database plugin is not available. "
                                       "please install it.\n"
                                       "There is no database plugin installed on your computer."));
        }
        else
        {
            DMessageBox::showInformationList(QMessageBox::Warning,
                                             qApp->activeWindow(),
                                             qApp->applicationName(),
                                             i18n("Run-time Qt SQLite or MySQL database plugin are not available. "
                                                  "Please install it.\n"
                                                  "Database plugins installed on your computer are listed below."),
                                             QSqlDatabase::drivers());
        }

        qCDebug(DIGIKAM_GENERAL_LOG) << "QT Sql drivers list: " << QSqlDatabase::drivers();
        return 1;
    }

    QString commandLineDBPath;

    if (parser.isSet(QLatin1String("database-directory")))
    {
        QDir commandLineDBDir(parser.value(QLatin1String("database-directory")));

        if (!commandLineDBDir.exists())
        {
            qCDebug(DIGIKAM_GENERAL_LOG) << "The given database-directory does not exist or is not readable. Ignoring." << commandLineDBDir.path();
        }
        else
        {
            commandLineDBPath = commandLineDBDir.path();
        }
    }

    if (parser.isSet(QLatin1String("config")))
    {
        QString configFilename = parser.value(QLatin1String("config"));
        QFileInfo configFile(configFilename);

        if (configFile.isDir() || !configFile.dir().exists() ||
            !configFile.isReadable() || !configFile.isWritable())
        {
            QMessageBox::critical(qApp->activeWindow(),
                                  qApp->applicationName(),
                                  QLatin1String("--config ") + configFilename
                                  + i18n("<p>The given path for the config file "
                                         "is not valid. Either its parent "
                                         "directory does not exist, it is a "
                                         "directory itself or it cannot be read/"
                                         "written to.</p>"));
            qCDebug(DIGIKAM_GENERAL_LOG) << "Invalid path: --config"
                                         << configFilename;
            return 1;
        }
    }

    KSharedConfig::Ptr config = KSharedConfig::openConfig();
    KConfigGroup group        = config->group(QLatin1String("General Settings"));
    QString version           = group.readEntry(QLatin1String("Version"), QString());
    QString iconTheme         = group.readEntry(QLatin1String("Icon Theme"), QString());
    KConfigGroup mainConfig   = config->group(QLatin1String("Album Settings"));

    QString            firstAlbumPath;
    DbEngineParameters params;

    // Run the first run assistant if we have no or very old config
    if (!mainConfig.exists() || (version.startsWith(QLatin1String("0.5"))))
    {
        FirstRunDlg firstRun;
        firstRun.show();

        if (firstRun.exec() == QDialog::Rejected)
        {
            return 1;
        }

        // parameters are written to config
        firstAlbumPath = firstRun.firstAlbumPath();

        if (firstRun.getDbEngineParameters().isSQLite())
        {
            AlbumManager::checkDatabaseDirsAfterFirstRun(firstRun.getDbEngineParameters().getCoreDatabaseNameOrDir(), firstAlbumPath);
        }
    }

    if (!commandLineDBPath.isNull())
    {
        // command line option set?
        params = DbEngineParameters::parametersForSQLiteDefaultFile(commandLineDBPath);
        ApplicationSettings::instance()->setDatabaseDirSetAtCmd(true);
        ApplicationSettings::instance()->setDbEngineParameters(params);
    }
    else
    {
        params = DbEngineParameters::parametersFromConfig(config);
        params.legacyAndDefaultChecks(firstAlbumPath);
        // sync to config, for all first-run or upgrade situations
        params.writeToConfig(config);
    }

    // initialize database
    if (!AlbumManager::instance()->setDatabase(params, !commandLineDBPath.isNull(), firstAlbumPath))
    {
        CoreDbAccess::cleanUpDatabase();
        ThumbsDbAccess::cleanUpDatabase();
        FaceDbAccess::cleanUpDatabase();
        SimilarityDbAccess::cleanUpDatabase();
        MetaEngine::cleanupExiv2();
        return 0;
    }

    if (!iconTheme.isEmpty())
    {
        QIcon::setThemeName(iconTheme);
    }

#ifdef Q_OS_WIN
    // Necessary to open native open with dialog on windows
    CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
#endif

    // create main window
    DigikamApp* const digikam = new DigikamApp();

    // If application storage place in home directory to save customized XML settings files do not exist, create it,
    // else QFile will not able to create new files as well.
    if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::DataLocation)))
    {
        QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::DataLocation));
    }

    // If application cache place in home directory to save cached files do not exist, create it.
    if (!QFile::exists(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)))
    {
        QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
    }

    // Bug #247175:
    // Add a connection to the destroyed() signal when the digiKam mainwindow has been
    // closed. This should prevent digiKam from staying open in the background.
    //
    // Right now this is the easiest and cleanest fix for the described problem, but we might re-think the
    // solution later on, just in case there are better ways to do it.
    QObject::connect(digikam, SIGNAL(destroyed(QObject*)),
                     &app, SLOT(quit()));

    digikam->restoreSession();
    digikam->show();

    if (parser.isSet(QLatin1String("download-from")))
    {
        digikam->downloadFrom(parser.value(QLatin1String("download-from")));
    }
    else if (parser.isSet(QLatin1String("download-from-udi")))
    {
        digikam->downloadFromUdi(parser.value(QLatin1String("download-from-udi")));
    }
    else if (parser.isSet(QLatin1String("detect-camera")))
    {
        digikam->autoDetect();
    }

    int ret = app.exec();

    CoreDbAccess::cleanUpDatabase();
    ThumbsDbAccess::cleanUpDatabase();
    FaceDbAccess::cleanUpDatabase();
    SimilarityDbAccess::cleanUpDatabase();
    MetaEngine::cleanupExiv2();

#ifdef Q_OS_WIN
    // Necessary to open native open with dialog on windows
    CoUninitialize();
#endif

#ifdef HAVE_IMAGE_MAGICK
#   if MagickLibVersion >= 0x693
    TerminateMagick();
#   endif
#endif

    return ret;
}
Esempio n. 5
0
void DatapickerCurve::init() {
	Q_D(DatapickerCurve);

	KConfig config;
	KConfigGroup group;
	group = config.group("DatapickerCurve");
	d->posXColumn = NULL;
	d->posYColumn = NULL;
	d->posZColumn = NULL;
	d->plusDeltaXColumn = NULL;
	d->minusDeltaXColumn = NULL;
	d->plusDeltaYColumn = NULL;
	d->minusDeltaYColumn = NULL;
	d->curveErrorTypes.x = (ErrorType) group.readEntry("CurveErrorType_X", (int) NoError);
	d->curveErrorTypes.y = (ErrorType) group.readEntry("CurveErrorType_X", (int) NoError);

	// point properties
	d->pointStyle = (Symbol::Style)group.readEntry("PointStyle", (int)Symbol::Cross);
	d->pointSize = group.readEntry("Size", Worksheet::convertToSceneUnits(7, Worksheet::Point));
	d->pointRotationAngle = group.readEntry("Rotation", 0.0);
	d->pointOpacity = group.readEntry("Opacity", 1.0);
	d->pointBrush.setStyle( (Qt::BrushStyle)group.readEntry("FillingStyle", (int)Qt::NoBrush) );
	d->pointBrush.setColor( group.readEntry("FillingColor", QColor(Qt::black)) );
	d->pointPen.setStyle( (Qt::PenStyle)group.readEntry("BorderStyle", (int)Qt::SolidLine) );
	d->pointPen.setColor( group.readEntry("BorderColor", QColor(Qt::red)) );
	d->pointPen.setWidthF( group.readEntry("BorderWidth", Worksheet::convertToSceneUnits(1, Worksheet::Point)) );
	d->pointErrorBarSize = group.readEntry("ErrorBarSize", Worksheet::convertToSceneUnits(8, Worksheet::Point));
	d->pointErrorBarBrush.setStyle( (Qt::BrushStyle)group.readEntry("ErrorBarFillingStyle", (int)Qt::NoBrush) );
	d->pointErrorBarBrush.setColor( group.readEntry("ErrorBarFillingColor", QColor(Qt::black)) );
	d->pointErrorBarPen.setStyle( (Qt::PenStyle)group.readEntry("ErrorBarBorderStyle", (int)Qt::SolidLine) );
	d->pointErrorBarPen.setColor( group.readEntry("ErrorBarBorderColor", QColor(Qt::black)) );
	d->pointErrorBarPen.setWidthF( group.readEntry("ErrorBarBorderWidth", Worksheet::convertToSceneUnits(1, Worksheet::Point)) );
	d->pointVisibility = group.readEntry("PointVisibility", true);

	this->initAction();
}
Esempio n. 6
0
void ScriptingSettings::saveSettings(KConfigGroup& group)
{
    group.writeEntry("Script", d->script->text());
}
Esempio n. 7
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. 8
0
void SlideShowSettings::writeToConfig()
{
    KSharedConfig::Ptr config = KSharedConfig::openConfig();
    KConfigGroup group        = config->group(configGroupName);

    group.writeEntry(configSlideShowStartCurrentEntry,         startWithCurrent);
    group.writeEntry(configSlideShowDelayEntry,                delay);
    group.writeEntry(configSlideShowLoopEntry,                 loop);
    group.writeEntry(configSlideShowPrintNameEntry,            printName);
    group.writeEntry(configSlideShowPrintDateEntry,            printDate);
    group.writeEntry(configSlideShowPrintApertureFocalEntry,   printApertureFocal);
    group.writeEntry(configSlideShowPrintExpoSensitivityEntry, printExpoSensitivity);
    group.writeEntry(configSlideShowPrintMakeModelEntry,       printMakeModel);
    group.writeEntry(configSlideShowPrintCommentEntry,         printComment);
    group.writeEntry(configSlideShowPrintTitleEntry,           printTitle);
    group.writeEntry(configSlideShowPrintCapIfNoTitleEntry,    printCapIfNoTitle);
    group.writeEntry(configSlideShowPrintTagsEntry,            printTags);
    group.writeEntry(configSlideShowPrintLabelsEntry,          printLabels);
    group.writeEntry(configSlideShowPrintRatingEntry,          printRating);
    group.writeEntry(configSlideShowProgressIndicatorEntry,    showProgressIndicator);
    group.writeEntry(configSlideShowCaptionFontEntry,          captionFont);
    group.writeEntry(configSlideScreenEntry,                   slideScreen);
    group.sync();
}
Esempio n. 9
0
void SlideShowSettings::readFromConfig()
{
    KSharedConfig::Ptr config = KSharedConfig::openConfig();
    KConfigGroup group        = config->group(configGroupName);

    startWithCurrent          = group.readEntry(configSlideShowStartCurrentEntry,         false);
    delay                     = group.readEntry(configSlideShowDelayEntry,                5);
    loop                      = group.readEntry(configSlideShowLoopEntry,                 false);
    printName                 = group.readEntry(configSlideShowPrintNameEntry,            true);
    printDate                 = group.readEntry(configSlideShowPrintDateEntry,            false);
    printApertureFocal        = group.readEntry(configSlideShowPrintApertureFocalEntry,   false);
    printExpoSensitivity      = group.readEntry(configSlideShowPrintExpoSensitivityEntry, false);
    printMakeModel            = group.readEntry(configSlideShowPrintMakeModelEntry,       false);
    printComment              = group.readEntry(configSlideShowPrintCommentEntry,         false);
    printTitle                = group.readEntry(configSlideShowPrintTitleEntry,           false);
    printCapIfNoTitle         = group.readEntry(configSlideShowPrintCapIfNoTitleEntry,    false);
    printTags                 = group.readEntry(configSlideShowPrintTagsEntry,            false);
    printLabels               = group.readEntry(configSlideShowPrintLabelsEntry,          false);
    printRating               = group.readEntry(configSlideShowPrintRatingEntry,          false);
    showProgressIndicator     = group.readEntry(configSlideShowProgressIndicatorEntry,    true);
    captionFont               = group.readEntry(configSlideShowCaptionFontEntry,
                                                QFontDatabase::systemFont(QFontDatabase::GeneralFont));
    slideScreen               = group.readEntry(configSlideScreenEntry,                   -2);
    exifRotate                = MetaEngineSettings::instance()->settings().exifRotate;
}
Esempio n. 10
0
void K3b::MediaCopyDialog::loadSettings( const KConfigGroup& c )
{
    m_writerSelectionWidget->loadConfig( c );
    m_comboSourceDevice->setSelectedDevice( k3bcore->deviceManager()->findDevice( c.readEntry( "source_device" ) ) );
    m_writingModeWidget->loadConfig( c );
    m_checkSimulate->setChecked( c.readEntry( "simulate", false ) );
    m_checkCacheImage->setChecked( !c.readEntry( "on_the_fly", false ) );
    m_checkDeleteImages->setChecked( c.readEntry( "delete_images", true ) );
    m_checkOnlyCreateImage->setChecked( c.readEntry( "only_create_image", false ) );
    m_comboParanoiaMode->setCurrentIndex( c.readEntry( "paranoia_mode", 0 ) );
    m_checkVerifyData->setChecked( c.readEntry( "verify data", false ) );

    m_spinCopies->setValue( c.readEntry( "copies", 1 ) );

    m_tempDirSelectionWidget->readConfig( c );

    if( c.readEntry( "copy mode", "normal" ) == "normal" )
        m_comboCopyMode->setCurrentIndex( 0 );
    else
        m_comboCopyMode->setCurrentIndex( 1 );

    m_checkReadCdText->setChecked( c.readEntry( "copy cdtext", true ) );
    m_checkIgnoreDataReadErrors->setChecked( c.readEntry( "ignore data read errors", false ) );
    m_checkIgnoreAudioReadErrors->setChecked( c.readEntry( "ignore audio read errors", true ) );
    m_checkNoCorrection->setChecked( c.readEntry( "no correction", false ) );

    m_spinDataRetries->setValue( c.readEntry( "data retries", 128 ) );
    m_spinAudioRetries->setValue( c.readEntry( "audio retries", 5 ) );

    slotToggleAll();
}
Esempio n. 11
0
void K3b::MediaCopyDialog::saveSettings( KConfigGroup c )
{
    m_writingModeWidget->saveConfig( c );
    c.writeEntry( "simulate", m_checkSimulate->isChecked() );
    c.writeEntry( "on_the_fly", !m_checkCacheImage->isChecked() );
    c.writeEntry( "delete_images", m_checkDeleteImages->isChecked() );
    c.writeEntry( "only_create_image", m_checkOnlyCreateImage->isChecked() );
    c.writeEntry( "paranoia_mode", m_comboParanoiaMode->currentText().toInt() );
    c.writeEntry( "copies", m_spinCopies->value() );
    c.writeEntry( "verify data", m_checkVerifyData->isChecked() );

    m_writerSelectionWidget->saveConfig( c );
    m_tempDirSelectionWidget->saveConfig( c );

    c.writeEntry( "source_device", m_comboSourceDevice->selectedDevice() ? m_comboSourceDevice->selectedDevice()->blockDeviceName() : QString() );

    c.writeEntry( "copy cdtext", m_checkReadCdText->isChecked() );
    c.writeEntry( "ignore data read errors", m_checkIgnoreDataReadErrors->isChecked() );
    c.writeEntry( "ignore audio read errors", m_checkIgnoreAudioReadErrors->isChecked() );
    c.writeEntry( "no correction", m_checkNoCorrection->isChecked() );
    c.writeEntry( "data retries", m_spinDataRetries->value() );
    c.writeEntry( "audio retries", m_spinAudioRetries->value() );

    QString s;
    if( m_comboCopyMode->currentIndex() == 1 )
        s = "clone";
    else
        s = "normal";
    c.writeEntry( "copy mode", s );
}
Esempio n. 12
0
void KTutorialEditor::saveProperties(KConfigGroup& configGroup) {
    configGroup.writeEntry("TutorialUrl", mFileActions->tutorialUrl());
}
Esempio n. 13
0
void KTutorialEditor::readProperties(const KConfigGroup& configGroup) {
    KUrl url = configGroup.readEntry("TutorialUrl");
    if (!url.isEmpty()) {
        mFileActions->loadTutorialFromUrl(url);
    }
}
Esempio n. 14
0
 static void process( QComboBox *cb, const KConfigGroup &config )
 {
   const int index = config.readEntry( cb->objectName(), -1 );
   if ( index >= 0 && index < cb->count() )
     cb->setCurrentIndex( index );
 }
OptimizePage::OptimizePage(Manager* const mngr, KAssistantDialog* const dlg)
    : KPWizardPage(dlg, i18n("<b>Optimization</b>")),
      d(new OptimizePagePriv)
{
    d->mngr                         = mngr;
    KVBox* vbox                     = new KVBox(this);
    d->progressTimer                = new QTimer(this);
    d->title                        = new QLabel(vbox);
    d->title->setOpenExternalLinks(true);
    d->title->setWordWrap(true);

    KConfig config("kipirc");
    KConfigGroup group              = config.group(QString("Panorama Settings"));

    d->horizonCheckbox              = new QCheckBox(i18n("Level horizon"), vbox);
    d->horizonCheckbox->setChecked(group.readEntry("Horizon", true));
    d->horizonCheckbox->setToolTip(i18n("Detect the horizon and adapt the project to make it horizontal."));
    d->horizonCheckbox->setWhatsThis(i18n("<b>Level horizon</b>: Detect the horizon and adapt the projection so that "
                                          "the detected horizon is an horizontal line in the final panorama"));
    d->projectionAndSizeCheckbox    = new QCheckBox(i18n("Automatic projection and crop"), vbox);
    d->projectionAndSizeCheckbox->setChecked(group.readEntry("Output Projection And Size", true));
    d->projectionAndSizeCheckbox->setToolTip(i18n("Adapt the projection of the panorama and the cropping on the resulting "
                                                  "projection so that every photo fits in the resulting panorama."));
    d->projectionAndSizeCheckbox->setWhatsThis(i18n("<b>Automatic projection and crop</b>: Automatically adapt the projection "
                                                    "and the crop of the panorama to get every photos into the panorama."));

    d->preprocessResults            = new QLabel(vbox);

    QLabel* space1                  = new QLabel(vbox);
    vbox->setStretchFactor(space1, 2);

    KHBox* hbox                     = new KHBox(vbox);
    d->detailsBtn                   = new QPushButton(hbox);
    d->detailsBtn->setText(i18n("Details..."));
    d->detailsBtn->hide();

    QLabel* space2                  = new QLabel(hbox);
    hbox->setStretchFactor(space2, 10);

    QLabel* space3                  = new QLabel(vbox);
    vbox->setStretchFactor(space3, 2);

    d->progressLabel                = new QLabel(vbox);
    d->progressLabel->setAlignment(Qt::AlignCenter);

    QLabel* space4                  = new QLabel(vbox);
    vbox->setStretchFactor(space4, 10);

    vbox->setSpacing(KDialog::spacingHint());
    vbox->setMargin(KDialog::spacingHint());

    setPageWidget(vbox);

    resetTitle();

    QPixmap leftPix = KStandardDirs::locate("data", "kipiplugin_panorama/pics/assistant-hugin.png");
    setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));

//     connect(d->mngr->thread(), SIGNAL(starting(KIPIPanoramaPlugin::ActionData)),
//             this, SLOT(slotAction(KIPIPanoramaPlugin::ActionData)));

    connect(d->progressTimer, SIGNAL(timeout()),
            this, SLOT(slotProgressTimerDone()));

    connect(d->detailsBtn, SIGNAL(clicked()),
            this, SLOT(slotShowDetails()));
}
Esempio n. 16
0
void KAResourceLocal::writeConfig(KConfigGroup& group)
{
    group.writePathEntry("CalendarURL", mURL.prettyUrl());
    AlarmResource::writeConfig(group);
}
Esempio n. 17
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. 18
0
/*!
    \fn KmlExport::getConfig()
 */
int KmlExport::getConfig()
{
    KConfig config("kipirc");
    KConfigGroup group   = config.group("KMLExport Settings");

    m_localTarget        = group.readEntry("localTarget", true);
    m_optimize_googlemap = group.readEntry("optimize_googlemap", false);
    m_iconSize           = group.readEntry("iconSize", 33);
    //    googlemapSize    = group.readNumEntry("googlemapSize");
    m_size               = group.readEntry("size", 320);

    // UrlDestDir have to have the trailing
    m_baseDestDir        = group.readEntry("baseDestDir", QString("/tmp/"));
    m_UrlDestDir         = group.readEntry("UrlDestDir", QString("http://www.example.com/"));
    m_KMLFileName        = group.readEntry("KMLFileName", QString("kmldocument"));
    m_altitudeMode       = group.readEntry("Altitude Mode", 0);

    m_GPXtracks          = group.readEntry("UseGPXTracks", false);
    m_GPXFile            = group.readEntry("GPXFile", QString());
    m_TimeZone           = group.readEntry("Time Zone", 12);
    m_LineWidth          = group.readEntry("Line Width", 4);
    m_GPXColor           = group.readEntry("Track Color", "#17eeee" );
    m_GPXOpacity         = group.readEntry("Track Opacity", 64 );
    m_GPXAltitudeMode    = group.readEntry("GPX Altitude Mode", 0);

    KStandardDirs dir;
    m_tempDestDir        = dir.saveLocation("tmp", "kipi-kmlrexportplugin-" + QString::number(getpid()) + '/');
    m_imageDir           = "images/";
    m_googlemapSize      = 32;
    return 1;
}
      continue;
    QListWidgetItem *item = new QListWidgetItem(KIcon(tag->iconName), tag->tagName, mListTag );
    item->setData(UrlTag, tag->nepomukResourceUri.toString());
    item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
    item->setCheckState( Qt::Unchecked );
    mListTag->addItem( item );

    if ( numberOfSelectedMessages == 1 ) {
      const bool hasTag = itemResource.tags().contains(  Nepomuk2::Tag( tag->tagName ) );
      item->setCheckState( hasTag ? Qt::Checked : Qt::Unchecked );
    } else {
      item->setCheckState( Qt::Unchecked );
    }    
  }

  KConfigGroup group( KMKernel::self()->config(), "TagSelectDialog" );
  const QSize size = group.readEntry( "Size", QSize() );
  if ( size.isValid() ) {
    resize( size );
  } else {
    resize( 500, 300 );
  }

}

TagSelectDialog::~TagSelectDialog()
{
  KConfigGroup group( KMKernel::self()->config(), "TagSelectDialog" );
  group.writeEntry( "Size", size() );

}
Esempio n. 20
0
void SwitchWindow::restore(const KConfigGroup &config)
{
    m_mode = (MenuMode)config.readEntry("mode", (int)AllFlat);
}
Esempio n. 21
0
void QStarDictApplet::init()
{
//     KConfigGroup cg = config();

    m_wordEdit = new LineEdit(this);
    m_wordEdit->nativeWidget()->setClearButtonShown( true );
    m_wordEdit->nativeWidget()->setClickMessage(i18n("Enter word to define here"));
    m_wordEdit->show();
    Plasma::Animator::self()->animateItem(m_wordEdit, Plasma::Animator::AppearAnimation);

//     m_defBrowser = new QWebView();
    m_defBrowser = new QTextBrowser();
    m_defBrowser->document()->setDefaultStyleSheet(QLatin1String(translationCSS));
    m_defBrowserProxy = new QGraphicsProxyWidget(this);
    m_defBrowserProxy->setWidget(m_defBrowser);
    m_defBrowserProxy->hide();
//  Icon in upper-left corner
	QString iconpath = KStandardDirs::locate("icon", "oxygen/scalable/apps/accessories-dictionary.svgz");
    m_icon = new Plasma::IconWidget(this);
    m_icon->setSvg(iconpath);

//  Position lineedits
    //const int wordEditOffset = 40;
    m_icon->setPos(12,3);
    //m_wordProxyWidget->setPos(15 + wordEditOffset,7);
    //m_wordProxyWidget->show();
    // TODO m_wordEdit->setDefaultTextColor(Plasma::Theme::self()->color(Plasma::Theme::TextColor));

//  Timer for auto-define
    m_timer = new QTimer(this);
    m_timer->setInterval(AUTO_DEFINE_TIMEOUT);
    m_timer->setSingleShot(true);
    connect(m_timer, SIGNAL(timeout()), this, SLOT(define()));

    m_horLayout = new QGraphicsLinearLayout(Qt::Horizontal);
    m_horLayout->addItem(m_icon);
    m_horLayout->addItem(m_wordEdit);
    m_layout = new QGraphicsLinearLayout(Qt::Vertical);
    m_layout->addItem(m_horLayout);
    m_layout->addItem(m_defBrowserProxy);
    setLayout(m_layout);

    m_source.clear();
    dataEngine("qstardict")->connectSource(m_source, this);
    connect(m_wordEdit, SIGNAL(editingFinished()), this, SLOT(define()));
    connect(m_wordEdit->nativeWidget(), SIGNAL(textChanged(const QString&)), this, SLOT(autoDefine(const QString&)));

    dataEngine("qstardict")->connectSource("list-dictionaries", this);

    //connect(m_defEdit, SIGNAL(linkActivated(const QString&)), this, SLOT(linkDefine(const QString&)));

//  This is the fix for links/selecting text
    //QGraphicsItem::GraphicsItemFlags flags = m_defEdit->flags();
    //flags ^= QGraphicsItem::ItemIsMovable;
   // m_defEdit->setFlags(flags);

    /*m_flash = new Plasma::Flash(this);
    m_flash->setColor(Qt::gray);
    QFont fnt = qApp->font();
    fnt.setBold(true);
    m_flash->setFont(fnt);
    m_flash->setPos(25,-10);
    m_flash->resize(QSize(200,20));*/



    KConfigGroup cg = config();
    m_dicts = cg.readEntry("KnownDictionaries", QStringList());
    QStringList activeDictNames = cg.readEntry("ActiveDictionaries", QStringList());
    for (QStringList::const_iterator i = m_dicts.constBegin(); i != m_dicts.constEnd(); ++i)
        m_activeDicts[*i]=activeDictNames.contains(*i);
}
Esempio n. 22
0
void SwitchWindow::save(KConfigGroup &config)
{
    config.writeEntry("mode", (int)m_mode);
}
Esempio n. 23
0
void nuclearCalculator::configChanged()
{
    KConfigGroup cg = config();

    m_massOnly = cg.readEntry("massOnly",true);
}
Esempio n. 24
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()));
}
Esempio n. 25
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. 26
0
void Worksheet::init() {
	KConfig config;
	KConfigGroup group = config.group( "Worksheet" );

	//size
	d->scaleContent = group.readEntry("ScaleContent", false);
	d->useViewSize = group.readEntry("UseViewSize", false);
	d->pageRect.setX(0);
	d->pageRect.setY(0);
	d->pageRect.setWidth(group.readEntry("Width", 1500));
	d->pageRect.setHeight(group.readEntry("Height",1500));

	//background
	d->backgroundType = (PlotArea::BackgroundType) group.readEntry("BackgroundType", (int) PlotArea::Color);
	d->backgroundColorStyle = (PlotArea::BackgroundColorStyle) group.readEntry("BackgroundColorStyle", (int) PlotArea::SingleColor);
	d->backgroundImageStyle = (PlotArea::BackgroundImageStyle) group.readEntry("BackgroundImageStyle", (int) PlotArea::Scaled);
	d->backgroundBrushStyle = (Qt::BrushStyle) group.readEntry("BackgroundBrushStyle", (int) Qt::SolidPattern);
	d->backgroundFileName = group.readEntry("BackgroundFileName", QString());
	d->backgroundFirstColor = group.readEntry("BackgroundFirstColor", QColor(Qt::white));
	d->backgroundSecondColor = group.readEntry("BackgroundSecondColor", QColor(Qt::black));
	d->backgroundOpacity = group.readEntry("BackgroundOpacity", 1.0);

	//layout
	d->layout = (Worksheet::Layout) group.readEntry("Layout", (int) Worksheet::VerticalLayout);
	d->layoutTopMargin =  group.readEntry("LayoutTopMargin", convertToSceneUnits(1, Centimeter));
	d->layoutBottomMargin = group.readEntry("LayoutBottomMargin", convertToSceneUnits(1, Centimeter));
	d->layoutLeftMargin = group.readEntry("LayoutLeftMargin", convertToSceneUnits(1, Centimeter));
	d->layoutRightMargin = group.readEntry("LayoutRightMargin", convertToSceneUnits(1, Centimeter));
	d->layoutVerticalSpacing = group.readEntry("LayoutVerticalSpacing", convertToSceneUnits(1, Centimeter));
	d->layoutHorizontalSpacing = group.readEntry("LayoutHorizontalSpacing", convertToSceneUnits(1, Centimeter));
	d->layoutRowCount = group.readEntry("LayoutRowCount", 2);
	d->layoutColumnCount = group.readEntry("LayoutColumnCount", 2);
}
Esempio n. 27
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. 28
0
void EventApplet::init()
{
    KConfigGroup cg = config();

    disabledResources = cg.readEntry("DisabledResources", QStringList());

    QString normalEventFormat = cg.readEntry("NormalEventFormat", QString("%{startDate} %{startTime} %{summary}"));
    QString todoFormat = cg.readEntry("TodoFormat", QString("%{dueDate} %{summary}"));
    QString noDueDateFormat = cg.readEntry("NoDueDateFormat", QString("%{summary}"));
    int dtFormat = cg.readEntry("DateFormat", ShortDateFormat);
    QString dtString = cg.readEntry("CustomDateFormat", QString("dd.MM."));
    m_period = cg.readEntry("Period", 365);

    m_urgency = cg.readEntry("UrgencyTime", 15);
    m_birthdayUrgency = cg.readEntry("BirthdayUrgencyTime", 14);

    m_urgentBg = QColor(cg.readEntry("UrgentColor", QString("#FF0000")));
    m_urgentBg.setAlphaF(cg.readEntry("UrgentOpacity", 10)/100.0);
    m_colors.insert(urgentColorPos, m_urgentBg);
    m_passedFg = QColor(cg.readEntry("PassedColor", QString("#C3C3C3")));
    m_colors.insert(passedColorPos, m_passedFg);
    
    m_todoBg = QColor(cg.readEntry("TodoColor", QString("#FFD235")));
    m_todoBg.setAlphaF(cg.readEntry("TodoOpacity", 10)/100.0);
    m_colors.insert(todoColorPos, m_todoBg);

    m_showFinishedTodos = cg.readEntry("ShowFinishedTodos", FALSE);
    
    m_finishedTodoBg = QColor(cg.readEntry("FinishedTodoColor", QString("#6FACE0")));
    m_finishedTodoBg.setAlphaF(cg.readEntry("FinishedTodoOpacity", 10)/100.0);
    m_colors.insert(finishedTodoColorPos, m_finishedTodoBg);

    int opacity = cg.readEntry("KOOpacity", 10);
    setupCategoryColors(opacity);

    QString koConfigPath = KStandardDirs::locateLocal("config", "korganizerrc");
    m_categoryColorWatch = new KDirWatch(this);
    m_categoryColorWatch->addFile(koConfigPath);
    connect(m_categoryColorWatch, SIGNAL(created(const QString &)), this, SLOT(koConfigChanged()));
    connect(m_categoryColorWatch, SIGNAL(dirty(const QString &)), this, SLOT(koConfigChanged()));

    connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged()));
    
    QStringList keys, values;
    keys << i18n("Birthday") << i18n("Holiday");
    values << QString("%{startDate} %{yearsSince}. %{summary}") << QString("%{startDate} %{summary} to %{endDate}");
    keys = cg.readEntry("CategoryFormatsKeys", keys);
    values = cg.readEntry("CategoryFormatsValues", values);

    for (int i = 0; i < keys.size(); ++i) {
        m_categoryFormat.insert(keys.at(i), values.at(i));
    }

    QStringList headerList;
    headerList << i18n("Today") << i18n("Events of today") << QString::number(0);
    headerList << i18n("Tomorrow") << i18n("Events for tomorrow") << QString::number(1);
    headerList << i18n("Week") << i18n("Events of the next week") << QString::number(2);
    headerList << i18n("Next 4 weeks") << i18n("Events for the next 4 weeks") << QString::number(8);
    headerList << i18n("Later") << i18n("Events later than 4 weeks") << QString::number(29);
    m_headerItemsList = cg.readEntry("HeaderItems", headerList);

    m_delegate = new EventItemDelegate(this, normalEventFormat, todoFormat, noDueDateFormat, dtFormat, dtString);
    m_delegate->setCategoryFormats(m_categoryFormat);

    graphicsWidget();

    Plasma::ToolTipManager::self()->registerWidget(this);
    createToolTip();

    lastCheckTime = QDateTime::currentDateTime();
    m_timer = new QTimer();
    connect(m_timer, SIGNAL(timeout()), this, SLOT(timerExpired()));
    QTimer::singleShot(0, this, SLOT(setupModel()));
}
Esempio n. 29
0
void WPEditAccount::writeConfig()
{
	KConfigGroup group = KGlobal::config()->group("WinPopup");
	group.writeEntry("SmbcPath", mSmbcPath->url().toLocalFile());
	group.writeEntry("HostCheckFreq", mHostCheckFreq->text());
}
Esempio n. 30
0
 static void process( QTabWidget *tab, const KConfigGroup &config )
 {
   const int index = config.readEntry( tab->objectName(), -1 );
   if ( index >= 0 && index < tab->count() )
     tab->setCurrentIndex( index );
 }