Esempio n. 1
0
void KompareShell::readProperties(const KConfigGroup &config)
{
	// The 'config' object points to the session managed
	// config file. This function is automatically called whenever
	// the app is being restored. Read in here whatever you wrote
	// in 'saveProperties'

	QString mode = config.readEntry( "Mode", "ComparingFiles" );
	if ( mode == "ComparingFiles" )
	{
		m_mode  = Kompare::ComparingFiles;
		m_sourceURL  = config.readPathEntry( "SourceUrl", "" );
		m_destinationURL = config.readPathEntry( "DestinationFile", "" );

		viewPart()->readProperties( const_cast<KConfig *>(config.config()) );

		viewPart()->compareFiles( m_sourceURL, m_destinationURL );
	}
	else if ( mode == "ShowingDiff" )
	{
		m_mode = Kompare::ShowingDiff;
		m_diffURL = config.readPathEntry( "DiffUrl", "" );

		viewPart()->readProperties( const_cast<KConfig *>(config.config()) );

		m_viewPart->openUrl( m_diffURL );
	}
	else
	{ // just in case something weird has happened, don't restore the diff then
	  // Bruggie: or when some idiot like me changes the possible values for mode
	  // IOW, a nice candidate for a kconf_update thingy :)
		viewPart()->readProperties( const_cast<KConfig *>(config.config()) );
	}
}
Esempio n. 2
0
void ICCSettingsContainer::readFromConfig(KConfigGroup& group)
{
    enableCM                      = group.readEntry("EnableCM", true);

    //if (!group.hasKey("OnProfileMismatch") && group.hasKey("BehaviourICC")) // legacy
    //  behavior = group.readEntry("BehaviourICC", false) ? "convert" : "ask";

    QString sRGB = IccProfile::sRGB().filePath();

    workspaceProfile              = group.readPathEntry("WorkProfileFile", sRGB);
    monitorProfile                = group.readPathEntry("MonitorProfileFile", sRGB);
    defaultInputProfile           = group.readPathEntry("InProfileFile", QString());
    defaultProofProfile           = group.readPathEntry("ProofProfileFile", QString());

    defaultMismatchBehavior       = (Behavior)group.readEntry("DefaultMismatchBehavior", (int)EmbeddedToWorkspace);
    defaultMissingProfileBehavior = (Behavior)group.readEntry("DefaultMissingProfileBehavior", (int)SRGBToWorkspace);
    defaultUncalibratedBehavior   = (Behavior)group.readEntry("DefaultUncalibratedBehavior", (int)AutoToWorkspace);

    lastMismatchBehavior          = (Behavior)group.readEntry("LastMismatchBehavior", (int)EmbeddedToWorkspace);
    lastMissingProfileBehavior    = (Behavior)group.readEntry("LastMissingProfileBehavior", (int)SRGBToWorkspace);
    lastUncalibratedBehavior      = (Behavior)group.readEntry("LastUncalibratedBehavior", (int)AutoToWorkspace);
    lastSpecifiedAssignProfile    = group.readEntry("LastSpecifiedAssignProfile", sRGB);
    lastSpecifiedInputProfile     = group.readEntry("LastSpecifiedInputProfile", defaultInputProfile);

    useBPC                        = group.readEntry("BPCAlgorithm", true);
    useManagedView                = group.readEntry("ManagedView", true);
    useManagedPreviews            = group.readEntry("ManagedPreviews", true);
    renderingIntent               = group.readEntry("RenderingIntent", (int)IccTransform::Perceptual);

    proofingRenderingIntent       = group.readEntry("ProofingRenderingIntent", (int)IccTransform::AbsoluteColorimetric);
    doGamutCheck                  = group.readEntry("DoGamutCheck", false);
    gamutCheckMaskColor           = group.readEntry("GamutCheckMaskColor", QColor(126, 255, 255));

    iccFolder                     = group.readEntry("DefaultPath", QString());
}
Esempio n. 3
0
ServiceButton::ServiceButton( const KConfigGroup& config, QWidget* parent )
  : PanelButton(parent, "ServiceButton"),
    _service(0)
{
    QString id;
    if (config.hasKey("StorageId"))
       id = config.readPathEntry("StorageId");
    else
       id = config.readPathEntry("DesktopFile");
    loadServiceFromId(id);
    initialize();
}
    void loadEntries(const KConfigGroup &grp)
    {
        recentFiles.clear();
        recentFilesIndex.clear();

        QString value;
        QString nameValue;
        QUrl url;

        KConfigGroup cg = grp;

        if ( cg.name().isEmpty()) {
            cg = KConfigGroup(cg.config(),"RecentFiles");
        }

        // read file list
        for (int i = 1; i <= maxItems; i++) {

            value = cg.readPathEntry(QString("File%1").arg(i), QString());
            if (value.isEmpty()) continue;
            url = QUrl(value);

            // gemini only handles local files
            // yes, i know the second half here isn't good on windows... but without it we fail on linux, and second part for windows
            if (!url.isLocalFile() && !value.startsWith('/') && value.midRef(2, 1) != QLatin1String(":")) {
                qDebug() << "Not a local file:" << url;
                continue;
            }

            // Don't restore if file doesn't exist anymore
            if (!QFile::exists(url.toLocalFile()) && !QFile::exists(value)) {
                qDebug() << "Recent file apparently no longer exists:" << url.toLocalFile();
                continue;
            }

            value = QDir::toNativeSeparators( value );

            // Don't restore where the url is already known (eg. broken config)
            if (recentFiles.contains(value))
                continue;

            nameValue = cg.readPathEntry(QString("Name%1").arg(i), url.fileName());

            if (!value.isNull())  {
                recentFilesIndex << nameValue;
                recentFiles << value;
           }
        }
    }
KAResourceLocal::KAResourceLocal(const KConfigGroup& group)
    : AlarmResource(group),
      mFileReadOnly(false)
{
    mURL = KUrl(group.readPathEntry("CalendarURL", QString()));
    init();
}
Esempio n. 6
0
bool SaverConfig::read(const QString &file)
{
    KDesktopFile config(file);
    const KConfigGroup group = config.desktopGroup();
#if 0
    if( !config.tryExec())
      return false;
#endif
    mExec = group.readPathEntry("Exec", QString());
    mName = group.readEntry("Name");
    QString categoryName = group.readEntry("X-KDE-Category");
    if(categoryName.isEmpty())
	mCategory = categoryName;
    else
        mCategory = i18nc("Screen saver category", // Must be same in CMakeFiles.txt
                     categoryName.toUtf8());

    if (config.hasActionGroup("Setup"))
    {
      mSetup = config.actionGroup("Setup").readPathEntry("Exec", QString());
    }

    if (config.hasActionGroup("InWindow"))
    {
      mSaver = config.actionGroup("InWindow").readPathEntry("Exec", QString());
    }

    int indx = file.lastIndexOf('/');
    if (indx >= 0) {
        mFile = file.mid(indx+1);
    }

    return !mSaver.isEmpty();
}
RecentProjectsDialogPage::RecentProjectsDialogPage()
    : KPageWidgetItem( new QWidget(), i18n( "Recent Projects" ) ),
      d( new RecentProjectsDialogPagePrivate( this ) )
{
    setIcon( KIcon( "document-open-recent" ) );

    d->widget = new QListWidget( widget() );
    connect( d->widget, SIGNAL( doubleClicked( QModelIndex ) ),
             SLOT( projectDoubleClicked( QModelIndex ) ) );

    QVBoxLayout* layout = new QVBoxLayout( widget() );
    widget()->setLayout( layout );
    layout->addWidget( d->widget );

    const KConfigGroup group = KGlobal::config()->group( "Recent Files" );
    const int entryCount = ( group.entryMap().count() / 2 );

    for( int i = entryCount; i >= 1; --i )
    {
        const QString key = QString( "File%1" ).arg( i );
        const QString path = group.readPathEntry( key, QString() );

        QListWidgetItem* item = new QListWidgetItem;
        item->setIcon( KIcon( "document-open-recent" ) );
        QString projectName = KUrl( path ).directory().split( '/' ).last();
        item->setText( QString( "%1\n%2" ).arg( projectName ).arg( path ) );
        item->setData( Qt::UserRole, path );
        d->widget->addItem( item );
    }
}
void CfgBrowser::load(KConfig *) 
{
    const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), QStringLiteral("General") );
    const QString exec = config.readPathEntry( QStringLiteral("BrowserApplication"), QString() );
    if (exec.isEmpty())
    {
        radioKIO->setChecked(true);
        m_browserExec = exec;
        m_browserService = 0;
    }
    else
    {
        radioExec->setChecked(true);
        if (exec.startsWith('!'))
        {
            m_browserExec = exec.mid(1);
            m_browserService = 0;
        }
        else
        {
            m_browserService = KService::serviceByStorageId( exec );
            if (m_browserService)
                m_browserExec = m_browserService->desktopEntryName();
            else
                m_browserExec.clear();
        }
    }

    lineExec->setText(m_browserExec);

    emit changed(false);
}
Esempio n. 9
0
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
Esempio n. 10
0
ResourceNet::ResourceNet( const KConfigGroup &group )
    : Resource( group ), mFormat( 0 ),
      mTempFile( 0 ),
      d( new ResourceNetPrivate )
{
    init( KUrl( group.readPathEntry( "NetUrl", QString() ) ), group.readEntry( "NetFormat" ) );
}
/**
 * \param grp group to read rules
 * \param need_clear should all current rule must be removed before
 */
void PluginConfiguration::readSanitizeRulesFrom(const KConfigGroup& grp, const bool need_clear)
{
    if (need_clear)
        m_sanitize_rules.clear();

    // Read sanitize rules from serializable form
    auto rules = grp.readPathEntry(SANITIZE_RULES_ITEM, QStringList{});
    for (auto&& rule : rules)
    {
        auto l = rule.split(SANITIZE_RULE_SEPARATOR);
        auto find = QString{};
        auto replace = QString{};
        switch (l.size())
        {
            case 2:
                replace.swap(l[1]);
            case 1:
                find.swap(l[0]);
                break;
            default:
            kWarning() << "Invalid sanitize rule ignored: " << rule;
        }
        kDebug(DEBUG_AREA) << "Got sanitize rule: find =" << find << ", replace =" << replace;
        if (!find.isEmpty())
        {
            auto find_regex = QRegExp{find};
            if (find_regex.isValid())
                m_sanitize_rules.emplace_back(std::move(find_regex), std::move(replace));
            else
                kWarning() << "Invalid sanitize rule ignored: " << rule;
        }
    }
}
Esempio n. 12
0
void CfgComponent::load(KConfig *cfg) {

	ComponentSelector->clear();
	m_lookupDict.clear();
	m_revLookupDict.clear();

	const KConfigGroup mainGroup = cfg->group(QByteArray());
	const QString serviceTypeToConfigure = mainGroup.readEntry("ServiceTypeToConfigure");

	const KService::List offers = KServiceTypeTrader::self()->query(serviceTypeToConfigure);

	for (KService::List::const_iterator tit = offers.begin(); tit != offers.end(); ++tit) {
		ComponentSelector->addItem((*tit)->name());
		m_lookupDict.insert((*tit)->name(), (*tit)->desktopEntryName());
		m_revLookupDict.insert((*tit)->desktopEntryName(), (*tit)->name());
	}

	KConfig store(mainGroup.readPathEntry("storeInFile","null"));
        const KConfigGroup group(&store, mainGroup.readEntry("valueSection"));
	QString setting = group.readEntry(mainGroup.readEntry("valueName","kcm_componenchooser_null"), QString());

	if (setting.isEmpty())
            setting = mainGroup.readEntry("defaultImplementation", QString());
	QString tmp = m_revLookupDict.value(setting);
	if (!tmp.isEmpty()) {
		for (int i=0;i<ComponentSelector->count();i++)
			if (tmp==ComponentSelector->itemText(i))
			{
				ComponentSelector->setCurrentIndex(i);
				break;
			}
        }
	emit changed(false);
}
Esempio n. 13
0
void IccProfilesSettings::readSettings(KConfigGroup& group)
{
    QStringList lastProfiles = group.readPathEntry(d->configRecentlyUsedProfilesEntry, QStringList());

    foreach(const QString& path, lastProfiles)
    {
        d->favoriteProfiles.insert(path, new bool(true));
    }
Esempio n. 14
0
void KTimerJob::load( KConfig *cfg, const QString& grp )
{
	KConfigGroup groupcfg = cfg->group(grp);
    setDelay( groupcfg.readEntry( "Delay", 100 ) );
    setCommand( groupcfg.readPathEntry( "Command", QString() ) );
    setLoop( groupcfg.readEntry( "Loop", false ) );
    setOneInstance( groupcfg.readEntry( "OneInstance", d->oneInstance ) );
    setState( (States)groupcfg.readEntry( "State", (int)Stopped ) );
}
void CervisiaShell::readProperties(const KConfigGroup& config)
{
    m_lastOpenDir = config.readPathEntry("Current Directory", QString());

    // if the session is restoring, make sure we open the URL
    // since it's not handled by main()
    if( kapp->isSessionRestored() )
        openURL();
}
Esempio n. 16
0
void K3b::ImageWritingDialog::loadSettings( const KConfigGroup& c )
{
    d->writingModeWidget->loadConfig( c );
    d->checkDummy->setChecked( c.readEntry("simulate", false ) );
    d->checkNoFix->setChecked( c.readEntry("multisession", false ) );
    d->checkCacheImage->setChecked( !c.readEntry("on_the_fly", true ) );

    d->dataModeWidget->loadConfig(c);

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

    d->checkVerify->setChecked( c.readEntry( "verify_data", false ) );

    d->writerSelectionWidget->loadConfig( c );

    if( !d->imageForced ) {
        QString image = c.readPathEntry( "image path", c.readPathEntry( "last written image", QString() ) );
        if( QFile::exists( image ) )
            d->editImagePath->setUrl( image );
    }

    QString imageType = c.readEntry( "image type", "auto" );
    int x = 0;
    if( imageType == "iso9660" )
        x = d->imageTypeSelectionMapRev[IMAGE_ISO];
    else if( imageType == "cue-bin" )
        x = d->imageTypeSelectionMapRev[IMAGE_CUE_BIN];
    else if( imageType == "audio-cue" )
        x = d->imageTypeSelectionMapRev[IMAGE_AUDIO_CUE];
    else if( imageType == "cdrecord-clone" )
        x = d->imageTypeSelectionMapRev[IMAGE_CDRECORD_CLONE];
    else if( imageType == "cdrdao-toc" )
        x = d->imageTypeSelectionMapRev[IMAGE_CDRDAO_TOC];

    d->comboImageType->setCurrentIndex( x );

    d->tempDirSelectionWidget->setTempPath( K3b::defaultTempPath() );

    slotToggleAll();
}
Esempio n. 17
0
void Repository::Private::readConfig()
{
    KSharedConfig::Ptr config = KGlobal::config();

    // Sometimes the location can be unequal to the entry in the CVS/Root.
    //
    // This can happen when the checkout was done with a repository name
    // like :pserver:[email protected]:/home/kde. When cvs then saves the
    // name into the .cvspass file, it adds the default cvs port to it like
    // this :pserver:[email protected]:2401/home/kde. This name is then also
    // used for the configuration group.
    //
    // In order to be able to read this group, we then have to manually add
    // the port number to it.
    QString repositoryGroup = QLatin1String("Repository-") + location;
    if( !config->hasGroup(repositoryGroup) )
    {
        // find the position of the first path separator
        const int insertPos = repositoryGroup.indexOf('/');
        if( insertPos > 0 )
        {
            // add port to location
            // (1) :pserver:[email protected]:/path
            if( repositoryGroup.at(insertPos - 1) == ':' )
                repositoryGroup.insert(insertPos, "2401");
            // (2) :pserver:[email protected]/path
            else
                repositoryGroup.insert(insertPos, ":2401");
        }
    }

    KConfigGroup group = config->group(repositoryGroup);

    // should we retrieve the CVSROOT/cvsignore file from the cvs server?
    retrieveCvsignoreFile = group.readEntry("RetrieveCvsignore", false);

    // see if there is a specific compression level set for this repository
    compressionLevel = group.readEntry("Compression", -1);

    // use default global compression level instead?
    if( compressionLevel < 0 )
    {
        KConfigGroup cs(config, "General");
        compressionLevel = cs.readEntry("Compression", 0);
    }

    // get remote shell client to access the remote repository
    rsh = group.readPathEntry("rsh", QString());

    // get program to start on the server side
    server = group.readEntry("cvs_server");
}
Esempio n. 18
0
ResourceLocal::ResourceLocal( const KConfigGroup &group )
  : ResourceNotes( group ), mCalendar( QString::fromLatin1( "UTC" ) )
{
  kDebug( 5500 ) << "ResourceLocal::ResourceLocal()";
  setType( "file" );
  mURL = KUrl::fromPath( KGlobal::dirs()->saveLocation( "data", "knotes/" ) +
                         "notes.ics" );

  KUrl u = group.readPathEntry( "NotesURL", QString() );
  if ( !u.isEmpty() ) {
    mURL = u;
  }
}
Esempio n. 19
0
void CfgComponent::save(KConfig *cfg) {
		// yes, this can happen if there are NO KTrader offers for this component
		if (!m_lookupDict.contains(ComponentSelector->currentText()))
			return;

		KConfigGroup mainGroup = cfg->group(QByteArray());
		QString serviceTypeToConfigure=mainGroup.readEntry("ServiceTypeToConfigure");
		KConfig store(mainGroup.readPathEntry("storeInFile", "null"));
		KConfigGroup cg(&store, mainGroup.readEntry("valueSection"));
		cg.writePathEntry(mainGroup.readEntry("valueName", "kcm_componenchooser_null"),
                                  m_lookupDict.value(ComponentSelector->currentText()));
		store.sync();
		emit changed(false);
}
Esempio n. 20
0
void KonqPixmapProvider::load( KConfigGroup& kc, const QString& key )
{
    iconMap.clear();
    const QStringList list = kc.readPathEntry( key, QStringList() );
    QStringList::const_iterator it = list.begin();
    QStringList::const_iterator itEnd = list.end();
    while ( it != itEnd ) {
        const QString url (*it);
        if ( (++it) == itEnd )
            break;
        const QString icon (*it);
        iconMap.insert( KUrl( url ), icon );
        ++it;
    }
}
static QStringList get_file_name( QWidget * parent ) {
    const QString certificateFilter = i18n("Certificates") + " (*.asc *.cer *.cert *.crt *.der *.pem *.gpg *.p7c *.p12 *.pfx *.pgp)";
    const QString anyFilesFilter = i18n("Any files") + " (*)";
    QString previousDir;
    if ( const KSharedConfig::Ptr config = KGlobal::config() ) {
        const KConfigGroup group( config, "Import Certificate" );
        previousDir = group.readPathEntry( "last-open-file-directory", QDir::homePath() );
    }
    const QStringList files = QFileDialog::getOpenFileNames( parent, i18n( "Select Certificate File" ), previousDir, certificateFilter + ";;" + anyFilesFilter );
    if ( !files.empty() )
        if ( const KSharedConfig::Ptr config = KGlobal::config() ) {
            KConfigGroup group( config, "Import Certificate" );
            group.writePathEntry( "last-open-file-directory", QFileInfo( files.front() ).path() );
        }
    return files;
}
Esempio n. 22
0
TestRegressionWindow::TestRegressionWindow(QWidget *parent)
: QMainWindow(parent), m_flags(None), m_runCounter(0), m_testCounter(0), m_totalTests(0),
					   m_totalTestsJS(0), m_totalTestsDOMTS(0), m_lastResult(Unknown),
					   m_browserPart(0), m_activeProcess(0), m_activeTreeItem(0),
					   m_suspended(false), m_justProcessingQueue(false)
{
	m_ui.setupUi(this);

	// Setup actions/connections
	connect(m_ui.actionOnly_run_JS_tests, SIGNAL(toggled(bool)), SLOT(toggleJSTests(bool)));
	connect(m_ui.actionOnly_run_HTML_tests, SIGNAL(toggled(bool)), SLOT(toggleHTMLTests(bool)));
	connect(m_ui.actionDo_not_suppress_debug_output, SIGNAL(toggled(bool)), SLOT(toggleDebugOutput(bool)));
	connect(m_ui.actionDo_not_use_Xvfb, SIGNAL(toggled(bool)), SLOT(toggleNoXvfbUse(bool)));
	connect(m_ui.actionSpecify_tests_directory, SIGNAL(triggered(bool)), SLOT(setTestsDirectory()));
	connect(m_ui.actionSpecify_khtml_directory, SIGNAL(triggered(bool)), SLOT(setKHTMLDirectory()));
	connect(m_ui.actionSpecify_output_directory, SIGNAL(triggered(bool)), SLOT(setOutputDirectory()));
	connect(m_ui.actionRun_tests, SIGNAL(triggered(bool)), SLOT(runTests()));

	connect(m_ui.pauseContinueButton, SIGNAL(clicked(bool)), SLOT(pauseContinueButtonClicked()));
	connect(m_ui.saveLogButton, SIGNAL(clicked(bool)), SLOT(saveLogButtonClicked()));

	connect(m_ui.treeWidget, SIGNAL(customContextMenuRequested(const QPoint &)),
			this, SLOT(treeWidgetContextMenuRequested(const QPoint &)));

	// Setup actions' default state
	m_ui.progressBar->setValue(0);
	m_ui.textEdit->setReadOnly(true);
	m_ui.actionRun_tests->setEnabled(false);
	m_ui.pauseContinueButton->setEnabled(false);

	m_ui.treeWidget->headerItem()->setTextAlignment(0, Qt::AlignLeft);
	m_ui.treeWidget->headerItem()->setText(0, i18n("Available Tests: 0"));

	// Load default values for tests directory/khtml directory...
	KConfig config("testregressiongui", KConfig::SimpleConfig);
	KConfigGroup grp = config.group("<default>");

	m_testsUrl = KUrl::fromPath(grp.readPathEntry("TestsDirectory", QString()));
	m_khtmlUrl = KUrl::fromPath(grp.readPathEntry("KHTMLDirectory", QString()));

	initTestsDirectory();

	// Init early visible items in the text edit...
	initLegend();
	initOutputBrowser();
}
/******************************************************************************
* Constructor to migrate a KResources calendar, using its parameters.
*/
CalendarCreator::CalendarCreator(const QString& resourceType, const KConfigGroup& config)
    : mAlarmType(CalEvent::EMPTY),
      mNew(false),
      mFinished(false)
{
    // Read the resource configuration parameters from the config
    const char* pathKey = 0;
    if (resourceType == QLatin1String("file"))
    {
        mResourceType = LocalFile;
        pathKey = "CalendarURL";
    }
    else if (resourceType == QLatin1String("dir"))
    {
        mResourceType = LocalDir;
        pathKey = "CalendarURL";
    }
    else if (resourceType == QLatin1String("remote"))
    {
        mResourceType = RemoteFile;
        pathKey = "DownloadUrl";
    }
    else
    {
        kError() << "Invalid resource type:" << resourceType;
        return;
    }
    mPath = config.readPathEntry(pathKey, "");
    switch (config.readEntry("AlarmType", (int)0))
    {
        case 1:  mAlarmType = CalEvent::ACTIVE;  break;
        case 2:  mAlarmType = CalEvent::ARCHIVED;  break;
        case 4:  mAlarmType = CalEvent::TEMPLATE;  break;
        default:
            kError() << "Invalid alarm type for resource";
            return;
    }
    mName     = config.readEntry("ResourceName", QString());
    mColour   = config.readEntry("Color", QColor());
    mReadOnly = config.readEntry("ResourceIsReadOnly", true);
    mEnabled  = config.readEntry("ResourceIsActive", false);
    mStandard = config.readEntry("Standard", false);
    kDebug() << "Migrating:" << mName << ", type=" << mAlarmType << ", path=" << mPath;
}
void KonqSidebarTree::loadTopLevelItem(KonqSidebarTreeItem *parent, const QString &path)
{
    KDesktopFile cfg( path );
    KConfigGroup desktopGroup = cfg.desktopGroup();
    const QString name = cfg.readName();

    // Here's where we need to create the right module...
    // ### TODO: make this KTrader/KLibrary based.
    const QString moduleName = desktopGroup.readPathEntry( "X-KDE-TreeModule", QString("Directory") );
    const QString showHidden = desktopGroup.readEntry("X-KDE-TreeModule-ShowHidden");

    kDebug(1201) << "##### Loading module: " << moduleName << " file: " << path;

    KonqSidebarTreeModule * module = NULL;
    getModule func = getPluginFactory(moduleName);
    if (func) {
        kDebug(1201)<<"showHidden: "<<showHidden;
        module=func(this,showHidden.toUpper()=="TRUE");
    }

    if (!module) {
        kDebug() << "No Module loaded for" << moduleName;
        return;
    }

    KonqSidebarTreeTopLevelItem *item;
    if ( parent )
        item = new KonqSidebarTreeTopLevelItem( parent, module, path );
    else
        item = new KonqSidebarTreeTopLevelItem( this, module, path );

    item->setText( 0, name );
    item->setPixmap( 0, SmallIcon( cfg.readIcon() ));

    module->addTopLevelItem( item );

    m_topLevelItems.append( item );
    m_lstModules.append( module );

    bool open = desktopGroup.readEntry( "Open", false);
    if ( open && item->isExpandable() )
        item->setOpen( true );
}
Esempio n. 25
0
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;
}
Esempio n. 26
0
void KadmosDialog::slotFontChanged( int id )
{
    m_cbLang->clear();

    const KConfigGroup grp = KGlobal::config()->group(CFG_GROUP_KADMOS);
    m_customClassifierPath = grp.readPathEntry(CFG_KADMOS_CLASSIFIER_PATH, "");

    bool enable = true;

    if( id == 0 )  /* Machine Print */
    {
        m_cbLang->addItems(m_ttfClassifier);
    }
    else if( id == 1 ) /* Hand Writing */
    {
        m_cbLang->addItems(m_handClassifier);
    }
    else if( id == 2 ) /* Norm Font */
    {
        enable = false;
    }
    m_cbLang->setEnabled( enable );
}
Esempio n. 27
0
void Workspace::readProperties( const KConfigGroup& cfg )
{
  QStringList selectedSheets = cfg.readPathEntry( "SelectedSheets", QStringList() );

  if ( selectedSheets.isEmpty() ) {
   /* If SelectedSheets config entry is not there, then it's
    * probably the first time the user has started KSysGuard. We
    * then "restore" a special default configuration. */
    selectedSheets << "ProcessTable.sgrd";
    selectedSheets << "SystemLoad2.sgrd";
  } else if(selectedSheets[0] != "ProcessTable.sgrd") {
    //We need to make sure that this is really is the process table on the first tab. No GUI way of changing this, but should make sure anyway.
    //Plus this migrates users from the kde3 setup
    selectedSheets.removeAll("ProcessTable.sgrd");
    selectedSheets.prepend( "ProcessTable.sgrd");
  }

  int oldSystemLoad = selectedSheets.indexOf("SystemLoad.sgrd");
  if(oldSystemLoad != -1) {
    selectedSheets.replace(oldSystemLoad, "SystemLoad2.sgrd");
  }

  KStandardDirs* kstd = KGlobal::dirs();
  QString filename;
  for ( QStringList::Iterator it = selectedSheets.begin(); it != selectedSheets.end(); ++it ) {
    filename = kstd->findResource( "data", "ksysguard/" + *it);
    if(!filename.isEmpty()) {
      restoreWorkSheet( filename, false);
    }
  }

  int idx = cfg.readEntry( "currentSheet", 0 );
  if (idx < 0 || idx > count() - 1) {
    idx = 0;
  }
  setCurrentIndex(idx);
}
KonqSideBarWebModule::KonqSideBarWebModule(const KComponentData &componentData, QWidget *parent, const KConfigGroup& configGroup)
    : KonqSidebarModule(componentData, parent, configGroup)
{
    _htmlPart = new KHTMLSideBar();
    _htmlPart->setAutoDeletePart(false);
    connect(_htmlPart, SIGNAL(reload()), this, SLOT(reload()));
    connect(_htmlPart, SIGNAL(completed()), this, SLOT(pageLoaded()));
    connect(_htmlPart,
            SIGNAL(setWindowCaption(QString)),
            this,
            SLOT(setTitle(QString)));
    connect(_htmlPart,
            SIGNAL(openUrlRequest(QString,KParts::OpenUrlArguments,KParts::BrowserArguments)),
            this,
            SLOT(urlClicked(QString,KParts::OpenUrlArguments,KParts::BrowserArguments)));
    connect(_htmlPart->browserExtension(),
            SIGNAL(openUrlRequest(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)),
            this,
            SLOT(formClicked(KUrl,KParts::OpenUrlArguments,KParts::BrowserArguments)) );
    connect(_htmlPart,
            SIGNAL(setAutoReload()), this, SLOT(setAutoReload()));
    connect(_htmlPart,
            SIGNAL(openUrlNewWindow(QString,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs)),
            this,
            SLOT(urlNewWindow(QString,KParts::OpenUrlArguments,KParts::BrowserArguments,KParts::WindowArgs)));
    connect(_htmlPart,
            SIGNAL(submitFormRequest(const char*,QString,QByteArray,QString,QString,QString)),
            this,
            SIGNAL(submitFormRequest(const char*,QString,QByteArray,QString,QString,QString)));

    reloadTimeout = configGroup.readEntry("Reload", 0);
    _url = configGroup.readPathEntry("URL", QString());
    _htmlPart->openUrl(_url );
    // Must load this delayed
    QTimer::singleShot(0, this, SLOT(loadFavicon()));
}
Esempio n. 29
0
OcrEngine::EngineError KadmosDialog::findClassifierPath()
{
    KStandardDirs stdDir;
    OcrEngine::EngineError err = OcrEngine::ENG_OK;

    const KConfigGroup grp = KGlobal::config()->group(CFG_GROUP_KADMOS);
    m_customClassifierPath = grp.readPathEntry(CFG_KADMOS_CLASSIFIER_PATH, "");
#if 0
    if( m_customClassifierPath == "NotFound" )
    {
        /* Wants the classifiers from the standard kde paths */
        KMessageBox::error(0, i18n("The classifier files for KADMOS could not be found.\n"
                                   "OCR with KADMOS will not be possible.\n\n"
                                   "Change the OCR engine in the preferences dialog."),
                           i18n("Installation Error") );
    }
    else
    {
        m_classifierPath = customPath;
    }
#endif
    return err;

}
Esempio n. 30
0
void MainWindow::readProperties(const KConfigGroup &group)
{
	const KUrl url(group.readPathEntry(QLatin1String("CurrentUrl"), QString()));
	if (url.isValid() && !url.isEmpty())
		loadUrl(Url(url));
}