本文整理汇总了C++中KConfig::deleteGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfig::deleteGroup方法的具体用法?C++ KConfig::deleteGroup怎么用?C++ KConfig::deleteGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfig
的用法示例。
在下文中一共展示了KConfig::deleteGroup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteView
void ViewManager::deleteView()
{
QString text = i18n("<qt>Are you sure that you want to delete the view <b>%1</b>?</qt>")
.arg(mActiveView->caption());
QString caption = i18n("Confirm Delete");
if(KMessageBox::warningContinueCancel(this, text, caption, KGuiItem(i18n("&Delete"), "editdelete")) == KMessageBox::Continue)
{
mViewNameList.remove(mActiveView->caption());
// remove the view from the config file
KConfig *config = mCore->config();
config->deleteGroup(mActiveView->caption());
mViewDict.remove(mActiveView->caption());
mActiveView = 0;
// we are in an invalid state now, but that should be fixed after
// we emit the signal
mActionSelectView->setItems(mViewNameList);
if(mViewNameList.count() > 0)
{
mActionSelectView->setCurrentItem(0);
setActiveView(mViewNameList[ 0 ]);
}
mActionDeleteView->setEnabled(mViewNameList.count() > 1);
}
}
示例2: readConfig
/******************************************************************************
* Read the configuration file.
* Create the client list and open all calendar files.
*/
void ADConfigData::readConfig()
{
kdDebug(5900) << "ADConfigData::readConfig()" << endl;
ClientInfo::clear();
KConfig *config = KGlobal::config();
QStringList clients = config->groupList().grep(CLIENT_GROUP_SEARCH);
for(QStringList::Iterator cl = clients.begin(); cl != clients.end(); ++cl)
{
// Read this client's configuration
config->setGroup(*cl);
QString client = *cl;
client.remove(CLIENT_GROUP_SEARCH);
QString title = config->readEntry(TITLE_KEY, client); // read app title (default = app name)
QCString dcopObject = config->readEntry(DCOP_OBJECT_KEY).local8Bit();
bool startClient = config->readBoolEntry(START_CLIENT_KEY, false);
QString calendar = config->readPathEntry(CALENDAR_KEY);
// Verify the configuration
bool ok = false;
if(client.isEmpty() || KStandardDirs::findExe(client).isNull())
kdError(5900) << "ADConfigData::readConfig(): group '" << *cl << "' deleted (client app not found)\n";
else if(calendar.isEmpty())
kdError(5900) << "ADConfigData::readConfig(): no calendar specified for '" << client << "'\n";
else if(dcopObject.isEmpty())
kdError(5900) << "ADConfigData::readConfig(): no DCOP object specified for '" << client << "'\n";
else
{
ADCalendar *cal = ADCalendar::getCalendar(calendar);
if(cal)
kdError(5900) << "ADConfigData::readConfig(): calendar registered by multiple clients: " << calendar << endl;
else
ok = true;
}
if(!ok)
{
config->deleteGroup(*cl, true);
continue;
}
// Create the client and calendar objects
new ClientInfo(client.local8Bit(), title, dcopObject, calendar, startClient);
kdDebug(5900) << "ADConfigData::readConfig(): client " << client << " : calendar " << calendar << endl;
}
// Remove obsolete CheckInterval entry (if it exists)
config->setGroup("General");
config->deleteEntry("CheckInterval");
// Save any updates
config->sync();
}
示例3: addView
void ViewManager::addView()
{
AddViewDialog dialog(&mViewFactoryDict, this);
if(dialog.exec())
{
QString newName = dialog.viewName();
QString type = dialog.viewType();
// Check for name conflicts
bool firstConflict = true;
int numTries = 1;
while(mViewNameList.contains(newName) > 0)
{
if(!firstConflict)
{
newName = newName.left(newName.length() - 4);
firstConflict = false;
}
newName = QString("%1 <%2>").arg(newName).arg(numTries);
numTries++;
}
// Add the new one to the list
mViewNameList.append(newName);
// write the view to the config file,
KConfig *config = mCore->config();
config->deleteGroup(newName);
KConfigGroupSaver saver(config, newName);
config->writeEntry("Type", type);
// try to set the active view
mActionSelectView->setItems(mViewNameList);
mActionSelectView->setCurrentItem(mViewNameList.findIndex(newName));
setActiveView(newName);
editView();
mActionDeleteView->setEnabled(mViewNameList.count() > 1);
}
}
示例4: removeTool
void ToolConfig::removeTool()
{
//KILE_DEBUG() << "==ToolConfig::removeTool()=====================" << endl;
if ( KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove the tool %1?").arg(m_current)) == KMessageBox::Continue )
{
KConfig *config = m_config;
QStringList cfgs = KileTool::configNames(m_current, config);
for ( uint i = 0; i < cfgs.count(); ++i)
{
config->deleteGroup(KileTool::groupFor(m_current, cfgs[i]));
}
config->setGroup("Tools");
config->deleteEntry(m_current);
int index = m_configWidget->m_lstbTools->currentItem()-1;
if ( index < 0 ) index=0;
QString tool = m_configWidget->m_lstbTools->text(index);
m_configWidget->m_lstbTools->blockSignals(true);
updateToollist();
m_configWidget->m_lstbTools->setCurrentItem(index);
switchTo(tool, false);
m_configWidget->m_lstbTools->blockSignals(false);
}
}
示例5: slotLoadPlugins
void KopeteApplication::slotLoadPlugins()
{
// we have to load the address book early, because calling this enters the Qt event loop when there are remote resources.
// The plugin manager is written with the assumption that Kopete will not reenter the event loop during plugin load,
// otherwise lots of things break as plugins are loaded, then contacts are added to incompletely initialised MCLVIs
Kopete::KABCPersistence::self()->addressBook();
//Create the command handler (looks silly)
Kopete::CommandHandler::commandHandler();
//Create the view manager
KopeteViewManager::viewManager();
Kopete::AccountManager::self()->load();
Kopete::ContactList::self()->load();
KConfig *config = KGlobal::config();
// Parse command-line arguments
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
bool showConfigDialog = false;
config->setGroup( "Plugins" );
/* FIXME: This is crap, if something purged that groups but your accounts
* are still working kopete will load the necessary plugins but still show the
* stupid accounts dialog (of course empty at that time because account data
* gets loaded later on). [mETz - 29.05.2004]
*/
if ( !config->hasGroup( "Plugins" ) )
showConfigDialog = true;
// Listen to arguments
/*
// TODO: conflicts with emoticon installer and the general meaning
// of %U in kopete.desktop
if ( args->count() > 0 )
{
showConfigDialog = false;
for ( int i = 0; i < args->count(); i++ )
Kopete::PluginManager::self()->setPluginEnabled( args->arg( i ), true );
}
*/
// Prevent plugins from loading? (--disable=foo,bar)
QStringList disableArgs = QStringList::split( ',', args->getOption( "disable" ) );
for ( QStringList::ConstIterator it = disableArgs.begin(); it != disableArgs.end(); ++it )
{
showConfigDialog = false;
Kopete::PluginManager::self()->setPluginEnabled( *it, false );
}
// Load some plugins exclusively? (--load-plugins=foo,bar)
if ( args->isSet( "load-plugins" ) )
{
config->deleteGroup( "Plugins", true );
showConfigDialog = false;
QStringList plugins = QStringList::split( ',', args->getOption( "load-plugins" ) );
for ( QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it )
Kopete::PluginManager::self()->setPluginEnabled( *it, true );
}
config->sync();
// Disable plugins altogether? (--noplugins)
if ( !args->isSet( "plugins" ) )
{
// If anybody reenables this I'll get a sword and make a nice chop-suy out
// of your body :P [mETz - 29.05.2004]
// This screws up kopeterc because there is no way to get the Plugins group back!
//config->deleteGroup( "Plugins", true );
showConfigDialog = false;
// pretend all plugins were loaded :)
QTimer::singleShot(0, this, SLOT( slotAllPluginsLoaded() ));
}
else
{
Kopete::PluginManager::self()->loadAllPlugins();
}
connect( Kopete::PluginManager::self(), SIGNAL( allPluginsLoaded() ),
this, SLOT( slotAllPluginsLoaded() ));
if( showConfigDialog )
{
// No plugins specified. Show the config dialog.
// FIXME: Although it's a bit stupid it is theoretically possible that a user
// explicitly configured Kopete to not load plugins on startup. In this
// case we don't want this dialog. We need some other config setting
// like a bool hasRunKopeteBefore or so to trigger the loading of the
// wizard. Maybe using the last run version number is more useful even
// as it also allows for other features. - Martijn
// FIXME: Possibly we need to influence the showConfigDialog bool based on the
// command line arguments processed below. But how exactly? - Martijn
// NB: the command line args are completely broken atm.
// I don't want to fix them for 3.5 as plugin loading will change for KDE4. - Will
AddAccountWizard *m_addwizard = new AddAccountWizard( Kopete::UI::Global::mainWidget(), "addAccountWizard", true, true );
m_addwizard->exec();
//.........这里部分代码省略.........
示例6: removeClient
/******************************************************************************
* Remove a client application's details from the config file.
*/
void ADConfigData::removeClient(const QCString &appName)
{
KConfig *config = KGlobal::config();
config->deleteGroup(CLIENT_GROUP + QString::fromLocal8Bit(appName));
config->sync();
}
示例7: config
//.........这里部分代码省略.........
rightside->addStretch();
// single checkbox
visEnable = new QCheckBox(i18n("Visualize progress in icon tray"), page);
top_box->addWidget(visEnable, 0, 0);
// let listbox claim all remaining vertical space
top_box->setStretchFactor(box, 10);
connect(confdlg, SIGNAL(helpClicked()), SLOT(help()));
}
// now add all defined teas (and their times) to the listview
// this is done backwards because QListViewItems are inserted at the top
listbox->clear();
for (int i=teas.count()-1; i>=0; i--) {
TeaListItem *item = new TeaListItem(listbox);
item->setName(teas[i].name);
item->setTime(teas[i].time);
if ((unsigned int)i == current_selected)
current_item = item;
}
// select first entry in listbox; if no entries present then disable right side
if (listempty) {
enable_controls();
disable_properties();
nameEdit->setText("");
timeEdit->setValue(1);
} else {
listbox->setSelected(listbox->firstChild(), true);
}
// -------------------------
eventEnable->setChecked(useNotify);
popupEnable->setChecked(usePopup);
actionEnable->setChecked(useAction);
actionEdit->setText(action);
actionEdit->setEnabled(useAction);
visEnable->setChecked(useTrayVis);
if (confdlg->exec() == QDialog::Accepted)
{
// activate new settings
useNotify = eventEnable->isChecked();
usePopup = popupEnable->isChecked();
useAction = actionEnable->isChecked();
action = actionEdit->text();
useTrayVis = visEnable->isChecked();
teas.clear();
// Copy over teas and times from the QListView
int i = 0;
teas.clear();
teas.resize(listbox->childCount());
for (QListViewItemIterator it(listbox); it.current() != 0; ++it) {
teas[i].name = static_cast<TeaListItem *>(it.current())->name();
teas[i].time = static_cast<TeaListItem *>(it.current())->time();
if (it.current() == current_item)
current_selected = i;
i++;
}
listempty = (teas.count() == 0);
rebuildTeaMenus();
// and store to config
KConfig *config = kapp->config();
// remove old-style entries from default-group (if present)
if (config->hasKey("UserTea"))
config->deleteEntry("UserTea");
config->setGroup("General");
config->writeEntry("Beep", useNotify);
config->writeEntry("Popup", usePopup);
config->writeEntry("UseAction", useAction);
config->writeEntry("Action", action);
config->writeEntry("Tea", current_selected);
config->writeEntry("UseTrayVis", useTrayVis);
// first get rid of all previous tea-entries from config, then write anew
config->deleteGroup("Teas", true); // deep remove of whole group
config->setGroup("Teas");
config->writeEntry("Number", teas.count());
QString key;
int index = 1;
for (QValueVector<tea_struct>::ConstIterator it = teas.begin(); it != teas.end(); ++it) {
key.sprintf("Tea%d Name", index);
config->writeEntry(key, it->name);
key.sprintf("Tea%d Time", index);
config->writeEntry(key, it->time);
index++;
}
config->sync();
}
}