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); }
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 kconfig_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. KConfigGroup config(KGlobal::config(), "General"); if (config.readEntry("CheckedForMenubar", false)) { return; } if (!KStandardDirs::locate("config", "kicker_menubarpanelrc").isEmpty()) { // don't overwrite/override something that's already there return; } QStringList elist = config.readEntry("Extensions2", QStringList() ); foreach (QString extensionId, elist) { if (extensionId.indexOf("Extension") == -1) { continue; } config.changeGroup(extensionId); // is there a config group for this extension? if (!config.exists() ) { continue; } QString extension = config.readPathEntry("ConfigFile", false); KConfig extensionConfig(KStandardDirs::locate("config", extension)); KConfigGroup eg (&extensionConfig, "General"); if (eg.hasKey("Applets2")) { QStringList containers = eg.readEntry("Applets2", QStringList() ); foreach (QString appletId, containers) { // is there a config group for this applet? if (!extensionConfig.hasGroup(appletId)) { continue; } KConfigGroup group(&extensionConfig, appletId); QString appletType = appletId.left(appletId.lastIndexOf('_')); if (appletType == "Applet") { QString appletFile = group.readPathEntry("DesktopFile", false); if (appletFile.indexOf("menuapplet.desktop") != -1) { QString menubarConfig = KStandardDirs::locate("config", extension); KIO::NetAccess::file_copy(menubarConfig, KStandardDirs::locateLocal("config", "kicker_menubarpanelrc"), 0); elist.removeAll(appletId); config.changeGroup("General"); config.writeEntry("Extensions2", elist); config.writeEntry("CheckedForMenubar", true); config.sync(); return; } } } } }