/** load the application */ void kweather::loadPrefs(){ kdDebug(12004) << "Loading Prefs" << endl; TDEConfig *kcConfig = config(); kcConfig->reparseConfiguration(); if (!kcConfig->hasGroup ("General Options") ) mFirstRun = true; kcConfig->setGroup("General Options"); logOn = kcConfig->readBoolEntry("logging", false); fileName = kcConfig->readPathEntry("log_file_name"); reportLocation = kcConfig->readEntry("report_location"); mViewMode = kcConfig->readNumEntry("smallview_mode", dockwidget::ShowAll); static TQColor black(TQt::black); mTextColor = kcConfig->readColorEntry("textColor", &black); }
void KCMStyle::loadStyle( TDEConfig& config ) { cbStyle->clear(); // Create a dictionary of WidgetStyle to Name and Desc. mappings, // as well as the config page info styleEntries.clear(); styleEntries.setAutoDelete(true); TQString strWidgetStyle; TQStringList list = TDEGlobal::dirs()->findAllResources("themes", "*.themerc", true, true); for (TQStringList::iterator it = list.begin(); it != list.end(); ++it) { KSimpleConfig config( *it, true ); if ( !(config.hasGroup("KDE") && config.hasGroup("Misc")) ) continue; config.setGroup("KDE"); strWidgetStyle = config.readEntry("WidgetStyle"); if (strWidgetStyle.isNull()) continue; // We have a widgetstyle, so lets read the i18n entries for it... StyleEntry* entry = new StyleEntry; config.setGroup("Misc"); entry->name = config.readEntry("Name"); entry->desc = config.readEntry("Comment", i18n("No description available.")); entry->configPage = config.readEntry("ConfigPage", TQString::null); // Check if this style should be shown config.setGroup("Desktop Entry"); entry->hidden = config.readBoolEntry("Hidden", false); // Insert the entry into our dictionary. styleEntries.insert(strWidgetStyle.lower(), entry); } // Obtain all style names TQStringList allStyles = TQStyleFactory::keys(); // Get translated names, remove all hidden style entries. TQStringList styles; StyleEntry* entry; for (TQStringList::iterator it = allStyles.begin(); it != allStyles.end(); it++) { TQString id = (*it).lower(); // Find the entry. if ( (entry = styleEntries.find(id)) != 0 ) { // Do not add hidden entries if (entry->hidden) continue; styles += entry->name; nameToStyleKey[entry->name] = id; } else { styles += (*it); //Fall back to the key (but in original case) nameToStyleKey[*it] = id; } } // Sort the style list, and add it to the combobox styles.sort(); cbStyle->insertStringList( styles ); // Find out which style is currently being used config.setGroup( "General" ); TQString defaultStyle = TDEStyle::defaultStyle(); TQString cfgStyle = config.readEntry( "widgetStyle", defaultStyle ); // Select the current style // Do not use cbStyle->listBox() as this may be NULL for some styles when // they use QPopupMenus for the drop-down list! // ##### Since Trolltech likes to seemingly copy & paste code, // TQStringList::findItem() doesn't have a Qt::StringComparisonMode field. // We roll our own (yuck) cfgStyle = cfgStyle.lower(); int item = 0; for( int i = 0; i < cbStyle->count(); i++ ) { TQString id = nameToStyleKey[cbStyle->text(i)]; item = i; if ( id == cfgStyle ) // ExactMatch break; else if ( id.contains( cfgStyle ) ) break; else if ( id.contains( TQApplication::style().className() ) ) break; item = 0; } cbStyle->setCurrentItem( item ); m_bStyleDirty = false; switchStyle( currentStyle() ); // make resets visible }
void ExtensionManager::initialize() { m_loadingContainers = true; // kdDebug(1210) << "ExtensionManager::loadContainerConfig()" << endl; TDEConfig* config = TDEGlobal::config(); PluginManager* pm = PluginManager::the(); // set up the "main" panel if (config->hasGroup("Main Panel")) { config->setGroup("Main Panel"); if (config->hasKey("DesktopFile")) { m_mainPanel = pm->createExtensionContainer(config->readPathEntry("DesktopFile"), true, config->readPathEntry("ConfigFile"), "Main Panel"); } } if (!m_mainPanel) { // fall back to a regular ol' PanelExtension m_mainPanel = pm->createExtensionContainer( "childpanelextension.desktop", true, TQString(kapp->aboutData()->appName()) + "rc", "Main Panel"); } if (!m_mainPanel) { KMessageBox::error(0, i18n("The TDE panel (kicker) could not load the main panel " "due to a problem with your installation. "), i18n("Fatal Error!")); exit(1); } configureMenubar(true); Kicker::the()->setMainWidget(m_mainPanel); m_mainPanel->readConfig(); m_mainPanel->show(); kapp->processEvents(); // read extension list config->setGroup("General"); TQStringList elist = config->readListEntry("Extensions2"); // now restore the extensions TQStringList::iterator itEnd = elist.end(); for (TQStringList::iterator it = elist.begin(); it != elist.end(); ++it) { // last container? TQStringList::iterator lastcheck(it); lastcheck++; if (lastcheck == elist.end()) { m_loadingContainers = false; } // extension id TQString extensionId(*it); // create a matching applet container if (extensionId.find("Extension") == -1) { continue; } // is there a config group for this extension? if (!config->hasGroup(extensionId)) { continue; } // set config group config->setGroup(extensionId); ExtensionContainer* e = pm->createExtensionContainer(config->readPathEntry("DesktopFile"), true, // is startup config->readPathEntry("ConfigFile"), extensionId); if (e) { addContainer(e); e->readConfig(); e->show(); kapp->processEvents(); } } m_loadingContainers = false; pm->clearUntrustedLists(); connect(Kicker::the(), TQT_SIGNAL(configurationChanged()), TQT_SLOT(configurationChanged())); DCOPRef r( "ksmserver", "ksmserver" ); r.send( "resumeStartup", TQCString( "kicker" )); }
void ExtensionManager::migrateMenubar() { // lame, lame, lame. // the menubar applet was just plunked into kicker and not much // thought was put into how it should be used. great idea, but no // integration. >:-( // so now we have to check to see if we HAVE another extension that // will have a menubar in it, and if so, abort creating one of our // own. // // the reason i didn't do this as a tdeconfig_update script is that // most people don't use this feature, so no reason to penalize // everyone, and moreover the user may added this to their main // panel, meaning kickerrc itself would have to be vastly modified // with lots of complications. not work it IMHO. TDEConfig* config = TDEGlobal::config(); config->setGroup("General"); if (config->readBoolEntry("CheckedForMenubar", false)) { return; } if (!locate("config", "kicker_menubarpanelrc").isEmpty()) { // don't overwrite/override something that's already there return; } TQStringList elist = config->readListEntry("Extensions2"); TQStringList::iterator itEnd = elist.end(); for (TQStringList::iterator it = elist.begin(); it != elist.end(); ++it) { TQString extensionId(*it); if (extensionId.find("Extension") == -1) { continue; } // is there a config group for this extension? if (!config->hasGroup(extensionId)) { continue; } config->setGroup(extensionId); TQString extension = config->readPathEntry("ConfigFile"); TDEConfig extensionConfig(locate("config", extension)); extensionConfig.setGroup("General"); if (extensionConfig.hasKey("Applets2")) { TQStringList containers = extensionConfig.readListEntry("Applets2"); TQStringList::iterator cit = containers.begin(); TQStringList::iterator citEnd = containers.end(); for (; cit != citEnd; ++cit) { TQString appletId(*cit); // is there a config group for this applet? if (!extensionConfig.hasGroup(appletId)) { continue; } TDEConfigGroup group(&extensionConfig, appletId.latin1()); TQString appletType = appletId.left(appletId.findRev('_')); if (appletType == "Applet") { TQString appletFile = group.readPathEntry("DesktopFile"); if (appletFile.find("menuapplet.desktop") != -1) { TQString menubarConfig = locate("config", extension); TDEIO::NetAccess::copy(menubarConfig, locateLocal("config", "kicker_menubarpanelrc"), 0); elist.remove(it); config->setGroup("General"); config->writeEntry("Extensions2", elist); config->writeEntry("CheckedForMenubar", true); config->sync(); return; } } } } } config->setGroup("General"); config->writeEntry("CheckedForMenubar", true); }