本文整理汇总了C++中KConfig类的典型用法代码示例。如果您正苦于以下问题:C++ KConfig类的具体用法?C++ KConfig怎么用?C++ KConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2:
TagDialog::~TagDialog()
{
KConfig *config = amaroK::config( "TagDialog" );
config->writeEntry( "CurrentTab", kTabWidget->currentPageIndex() );
}
示例3: slotApply
void KateConfigDialog::slotApply()
{
KConfig *config = KateApp::self()->config();
// if data changed apply the kate app stuff
if(dataChanged)
{
config->setGroup("General");
config->writeEntry("Restore Window Configuration", cb_restoreVC->isChecked());
int bu = sessions_start->id(sessions_start->selected());
if(bu == 0)
config->writeEntry("Startup Session", "new");
else if(bu == 1)
config->writeEntry("Startup Session", "last");
else
config->writeEntry("Startup Session", "manual");
bu = sessions_exit->id(sessions_exit->selected());
if(bu == 0)
config->writeEntry("Session Exit", "discard");
else if(bu == 1)
config->writeEntry("Session Exit", "save");
else
config->writeEntry("Session Exit", "ask");
config->writeEntry("Save Meta Infos", cb_saveMetaInfos->isChecked());
KateDocManager::self()->setSaveMetaInfos(cb_saveMetaInfos->isChecked());
config->writeEntry("Days Meta Infos", sb_daysMetaInfos->value());
KateDocManager::self()->setDaysMetaInfos(sb_daysMetaInfos->value());
config->writeEntry("Modified Notification", cb_modNotifications->isChecked());
mainWindow->modNotification = cb_modNotifications->isChecked();
mainWindow->syncKonsole = cb_syncKonsole->isChecked();
fileSelConfigPage->apply();
filelistConfigPage->apply();
configExternalToolsPage->apply();
KateExternalToolsCommand::self()->reload();
for(uint i = 0; i < KateApp::self()->mainWindows(); i++)
{
KateMainWindow *win = KateApp::self()->mainWindow(i);
win->externalTools->reload();
}
// mainWindow->externalTools->reload();
mainWindow->viewManager()->setShowFullPath(cb_fullPath->isChecked()); // hm, stored 2 places :(
mainWindow->saveOptions();
// save plugin config !!
KateApp::self()->pluginManager()->writeConfig();
}
//
// editor config ! (the apply() methode will check the changed state internally)
//
for(uint i = 0; i < editorPages.count(); i++)
{
editorPages.at(i)->apply();
}
v->getDoc()->writeConfig(config);
//
// plugins config ! (the apply() methode SHOULD check the changed state internally)
//
for(uint i = 0; i < pluginPages.count(); i++)
{
pluginPages.at(i)->page->apply();
}
config->sync();
dataChanged = false;
actionButton(KDialogBase::Apply)->setEnabled(false);
}
示例4: Q_ASSERT
void UserAgentDlg::save()
{
Q_ASSERT (m_config);
// Put all the groups except the default into the delete list.
QStringList deleteList = m_config->groupList();
//Remove all the groups that DO NOT contain a "UserAgent" entry...
QStringList::ConstIterator endIt = deleteList.constEnd();
for (QStringList::ConstIterator it = deleteList.constBegin(); it != endIt; ++it) {
if ( (*it) == QLatin1String ("<default>"))
continue;
KConfigGroup cg (m_config, *it);
if (!cg.hasKey ("UserAgent"))
deleteList.removeAll (*it);
}
QString domain;
QTreeWidgetItem* item;
int itemCount = ui.sitePolicyTreeWidget->topLevelItemCount();
// Save and remove from the delete list all the groups that were
// not deleted by the end user.
for (int i = 0; i < itemCount; i++) {
item = ui.sitePolicyTreeWidget->topLevelItem (i);
domain = item->text (0);
KConfigGroup cg (m_config, domain);
cg.writeEntry ("UserAgent", item->text (2));
deleteList.removeAll (domain);
qDebug ("UserAgentDlg::save: Removed [%s] from delete list", domain.toLatin1().constData());
}
// Write the global configuration information...
KConfigGroup cg (m_config, QString());
cg.writeEntry ("SendUserAgent", ui.sendUACheckBox->isChecked());
cg.writeEntry ("UserAgentKeys", m_ua_keys);
// Sync up all the changes so far...
m_config->sync();
// If delete list is not empty, delete the specified domains.
if (!deleteList.isEmpty()) {
// Remove entries from local file.
endIt = deleteList.constEnd();
KConfig cfg (QStringLiteral("kio_httprc"), KConfig::SimpleConfig);
for (QStringList::ConstIterator it = deleteList.constBegin(); it != endIt; ++it) {
KConfigGroup cg (&cfg, *it);
cg.deleteEntry ("UserAgent");
qDebug ("UserAgentDlg::save: Deleting UserAgent of group [%s]", (*it).toLatin1().constData());
if (cg.keyList().count() < 1)
cg.deleteGroup();
}
// Sync up the configuration...
cfg.sync();
// Check everything is gone, reset to blank otherwise.
m_config->reparseConfiguration();
endIt = deleteList.constEnd();
for (QStringList::ConstIterator it = deleteList.constBegin(); it != endIt; ++it) {
KConfigGroup cg (m_config, *it);
if (cg.hasKey ("UserAgent"))
cg.writeEntry ("UserAgent", QString());
}
// Sync up the configuration...
m_config->sync();
}
KSaveIOConfig::updateRunningIOSlaves (this);
configChanged (false);
}
示例5: kdDebug
void KSANEOCR::startOCRAD( )
{
ocradDialog *ocrDia = static_cast<ocradDialog*>(m_ocrProcessDia);
m_ocrResultImage = ocrDia->orfUrl();
const QString cmd = ocrDia->getOCRCmd();
// if( m_ocrResultImage.isEmpty() )
{
/* The url is empty. Start the program to fill up a temp file */
m_ocrResultImage = ImgSaver::tempSaveImage( m_img, "BMP", 8 ); // m_tmpFile->name();
kdDebug(28000) << "The new image name is <" << m_ocrResultImage << ">" << endl;
}
m_ocrImagePBM = ImgSaver::tempSaveImage( m_img, "PBM", 1 );
/* temporar file for orf result */
KTempFile *tmpOrf = new KTempFile( QString(), ".orf" );
tmpOrf->setAutoDelete( false );
tmpOrf->close();
m_tmpOrfName = QFile::encodeName(tmpOrf->name());
if( daemon )
{
delete( daemon );
daemon = 0;
}
daemon = new KProcess;
Q_CHECK_PTR(daemon);
*daemon << cmd;
*daemon << QString("-x");
*daemon << m_tmpOrfName; // the orf result file
*daemon << QFile::encodeName( m_ocrImagePBM ); // The name of the image
*daemon << QString("-l");
*daemon << QString::number( ocrDia->layoutDetectionMode());
KConfig *konf = KGlobal::config ();
KConfigGroupSaver( konf, CFG_GROUP_OCRAD );
QString format = konf->readEntry( CFG_OCRAD_FORMAT, "utf8");
*daemon << QString("-F");
*daemon << format;
QString charset = konf->readEntry( CFG_OCRAD_CHARSET, "iso-8859-15");
*daemon << QString("-c");
*daemon << charset;
QString addArgs = konf->readEntry( CFG_OCRAD_EXTRA_ARGUMENTS, QString() );
if( !addArgs.isEmpty() )
{
kdDebug(28000) << "Setting additional args from config for ocrad: " << addArgs << endl;
*daemon << addArgs;
}
m_ocrResultText = "";
connect(daemon, SIGNAL(processExited(KProcess *)),
this, SLOT( ocradExited(KProcess*)));
connect(daemon, SIGNAL(receivedStdout(KProcess *, char*, int)),
this, SLOT( ocradStdIn(KProcess*, char*, int)));
connect(daemon, SIGNAL(receivedStderr(KProcess *, char*, int)),
this, SLOT( ocradStdErr(KProcess*, char*, int)));
if (!daemon->start(KProcess::NotifyOnExit, KProcess::All))
{
kdDebug(28000) << "Error starting ocrad-daemon!" << endl;
}
else
{
kdDebug(28000) << "Start OK" << endl;
}
delete tmpOrf;
}
示例6: KListViewItem
void K3bCddbOptionTab::readSettings()
{
KConfig* c = kapp->config();
c->setGroup( "Cddb" );
// old config <= 0.7.3
QStringList cddbpServer = c->readListEntry( "cddbp server" );
QStringList httpServer = c->readListEntry( "http server" );
// new config
QStringList cddbServer = c->readListEntry( "cddb server" );
QStringList localCddbDirs = c->readPathListEntry( "local cddb dirs" );
m_checkRemoteCddb->setChecked( c->readBoolEntry( "use remote cddb", true ) );
m_checkUseLocalCddb->setChecked( c->readBoolEntry( "use local cddb query", true ) );
m_checkSaveLocalEntries->setChecked( c->readBoolEntry( "save cddb entries locally", true ) );
m_checkManualCgiPath->setChecked( c->readBoolEntry( "use manual cgi path", false ) );
m_editManualCgiPath->setText( c->readEntry( "cgi path", "/~cddb/cddb.cgi" ) );
if( localCddbDirs.isEmpty() )
localCddbDirs.append( "~/.cddb/" );
for( QStringList::const_iterator it = localCddbDirs.begin(); it != localCddbDirs.end(); ++it )
(void)new KListViewItem( m_viewLocalDir, m_viewLocalDir->lastItem(), *it );
// old config <= 0.7.3
if( !httpServer.isEmpty() ) {
for( QStringList::iterator it = httpServer.begin(); it != httpServer.end(); ++it ) {
cddbServer.append( "Http " + *it );
}
}
if( !cddbpServer.isEmpty() ) {
for( QStringList::iterator it = cddbpServer.begin(); it != cddbpServer.end(); ++it ) {
cddbServer.append( "Cddbp " + *it );
}
}
if( cddbServer.isEmpty() )
cddbServer.append( "Http freedb2.org:80" );
for( QStringList::const_iterator it = cddbServer.begin(); it != cddbServer.end(); ++it ) {
const QString& s = *it;
QStringList buf = QStringList::split( ":", s.mid( s.find(" ")+1 ) );
QString server = buf[0];
int port = buf[1].toInt();
if( s.startsWith("Http") )
(void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), "Http", server, QString::number(port) );
else
(void)new KListViewItem( m_viewCddbServer, m_viewCddbServer->lastItem(), "Cddbp", server, QString::number(port) );
}
enDisableButtons();
}
示例7: save
void DolphinIconsViewSettings::save()
{
KConfig* config = kapp->config();
setConfigGroup(config);
config->writeEntry("Icon Size", m_iconSize);
if (m_arrangement == QIconView::LeftToRight) {
config->writeEntry("Arrangement", "Left to Right");
}
else {
config->writeEntry("Arrangement", "Top to Bottom");
}
config->writeEntry("Preview Size", m_previewSize);
config->writeEntry("Grid Width", m_gridWidth);
config->writeEntry("Grid Height", m_gridHeight);
config->writeEntry("Grid Spacing", m_gridSpacing);
config->writeEntry("Font Size", m_fontSize);
config->writeEntry("Font Family", m_fontFamily);
config->writeEntry("Number of Textlines", m_textlinesCount);
}
示例8: config
KProtocolManager::ProxyAuthMode KProtocolManager::proxyAuthMode()
{
KConfig *cfg = config();
cfg->setGroup("Proxy Settings");
return static_cast< ProxyAuthMode >(cfg->readNumEntry("AuthMode"));
}
示例9: http_config
bool KProtocolManager::useCache()
{
KConfig *cfg = http_config();
return cfg->readBoolEntry("UseCache", true);
}
示例10: DCOPObject
KNotesApp::KNotesApp()
: DCOPObject("KNotesIface"), QLabel( 0, 0, WType_TopLevel ),
m_alarm( 0 ), m_listener( 0 ), m_find( 0 ), m_findPos( 0 )
{
connect( kapp, SIGNAL(lastWindowClosed()), kapp, SLOT(quit()) );
m_noteList.setAutoDelete( true );
m_noteActions.setAutoDelete( true );
// create the dock widget...
KWin::setSystemTrayWindowFor( winId(), qt_xrootwin() );
QToolTip::add( this, i18n( "KNotes: Sticky notes for KDE" ) );
setBackgroundMode( X11ParentRelative );
setPixmap( KSystemTray::loadIcon( "knotes" ) );
// set the initial style
KNote::setStyle( KNotesGlobalConfig::style() );
// create the GUI...
new KAction( i18n("New Note"), "filenew", 0,
this, SLOT(newNote()), actionCollection(), "new_note" );
new KAction( i18n("New Note From Clipboard"), "editpaste", 0,
this, SLOT(newNoteFromClipboard()), actionCollection(), "new_note_clipboard" );
new KAction( i18n("Show All Notes"), "knotes", 0,
this, SLOT(showAllNotes()), actionCollection(), "show_all_notes" );
new KAction( i18n("Hide All Notes"), "fileclose", 0,
this, SLOT(hideAllNotes()), actionCollection(), "hide_all_notes" );
new KHelpMenu( this, kapp->aboutData(), false, actionCollection() );
KStdAction::find( this, SLOT(slotOpenFindDialog()), actionCollection() );
KStdAction::preferences( this, SLOT(slotPreferences()), actionCollection() );
KStdAction::keyBindings( this, SLOT(slotConfigureAccels()), actionCollection() );
//FIXME: no shortcut removing!?
KStdAction::quit( this, SLOT(slotQuit()), actionCollection() )->setShortcut( 0 );
setXMLFile( instance()->instanceName() + "appui.rc" );
m_guiBuilder = new KXMLGUIBuilder( this );
m_guiFactory = new KXMLGUIFactory( m_guiBuilder, this );
m_guiFactory->addClient( this );
m_context_menu = static_cast<KPopupMenu*>(m_guiFactory->container( "knotes_context", this ));
m_note_menu = static_cast<KPopupMenu*>(m_guiFactory->container( "notes_menu", this ));
// get the most recent XML UI file
QString xmlFileName = instance()->instanceName() + "ui.rc";
QString filter = QString::fromLatin1( instance()->instanceName() + '/' ) + xmlFileName;
QStringList fileList = instance()->dirs()->findAllResources( "data", filter ) +
instance()->dirs()->findAllResources( "data", xmlFileName );
QString doc;
KXMLGUIClient::findMostRecentXMLFile( fileList, doc );
m_noteGUI.setContent( doc );
// create accels for global shortcuts
m_globalAccel = new KGlobalAccel( this, "global accel" );
m_globalAccel->insert( "global_new_note", i18n("New Note"), "",
ALT+SHIFT+Key_N, ALT+SHIFT+Key_N ,
this, SLOT(newNote()), true, true );
m_globalAccel->insert( "global_new_note_clipboard", i18n("New Note From Clipboard"), "",
ALT+SHIFT+Key_C, ALT+SHIFT+Key_C,
this, SLOT(newNoteFromClipboard()), true, true );
m_globalAccel->insert( "global_hide_all_notes", i18n("Hide All Notes"), "",
ALT+SHIFT+Key_H, ALT+SHIFT+Key_H ,
this, SLOT(hideAllNotes()), true, true );
m_globalAccel->insert( "global_show_all_notes", i18n("Show All Notes"), "",
ALT+SHIFT+Key_S, ALT+SHIFT+Key_S,
this, SLOT(showAllNotes()), true, true );
m_globalAccel->readSettings();
KConfig *config = KGlobal::config();
config->setGroup( "Global Keybindings" );
m_globalAccel->setEnabled( config->readBoolEntry( "Enabled", true ) );
updateGlobalAccels();
// clean up old config files
KNotesLegacy::cleanUp();
// create the resource manager
m_manager = new KNotesResourceManager();
connect( m_manager, SIGNAL(sigRegisteredNote( KCal::Journal * )),
this, SLOT(createNote( KCal::Journal * )) );
connect( m_manager, SIGNAL(sigDeregisteredNote( KCal::Journal * )),
this, SLOT(killNote( KCal::Journal * )) );
// read the notes
m_manager->load();
// read the old config files, convert and add them
KCal::CalendarLocal calendar( QString::fromLatin1( "UTC" ) );
if ( KNotesLegacy::convert( &calendar ) )
{
KCal::Journal::List notes = calendar.journals();
KCal::Journal::List::ConstIterator it;
for ( it = notes.begin(); it != notes.end(); ++it )
m_manager->addNewNote( *it );
m_manager->save();
//.........这里部分代码省略.........
示例11: KTopLevelWidget
//.........这里部分代码省略.........
/*
QToolTip::add( doneButton, trans->translate(
"Click here when you think you placed all the balls.") );
*/
QString tmps;
stat = new KStatusBar( this );
tmps.sprintf( "aaaaaaaa" );
stat->insertItem( (const char *) tmps, SSCORE );
tmps.sprintf( "aaaaaaaaaaa" );
stat->insertItem( (const char *) tmps, SBALLS );
tmps.sprintf( "aaaaaaa" );
stat->insertItem( (const char *) tmps, SRUN );
tmps.sprintf( "aaaaaaaaaa" );
stat->insertItem( (const char *) tmps, SSIZE );
setStatusBar( stat );
tool = new KToolBar( this );
tool->insertButton( loader->loadIcon("exit.xpm"),
ID_QUIT, TRUE, trans->translate("Quit") );
tool->insertButton( loader->loadIcon("reload.xpm"),
ID_NEW, TRUE, trans->translate("New") );
tool->insertButton( loader->loadIcon("giveup.xpm"),
ID_GIVEUP, TRUE, trans->translate("Give up") );
tool->insertButton( loader->loadIcon("done.xpm"),
ID_DONE, TRUE, trans->translate("Done") );
tool->insertSeparator();
tool->insertButton( loader->loadIcon("help.xpm"), ID_HELP, TRUE,
trans->translate("Help") );
connect( tool, SIGNAL(clicked(int)), SLOT(callBack(int)) );
addToolBar( tool );
tool->setBarPos( KToolBar::Top );
tool->show();
/*
Game initializations
*/
running = FALSE;
gameBoard = NULL;
KConfig *kConf;
int j;
kConf = KApplication::getKApplication()->getConfig();
kConf->setGroup( "KBlackBox Setup" );
if (kConf->hasKey( "Balls" )) {
i = kConf->readNumEntry( "Balls" );
balls = i;
switch (i) {
case 4: ballsm->setItemChecked( balls1id, TRUE ); break;
case 6: ballsm->setItemChecked( balls2id, TRUE ); break;
case 8: ballsm->setItemChecked( balls3id, TRUE ); break;
}
} else {
balls = 4;
ballsm->setItemChecked( balls1id, TRUE );
}
if ((kConf->hasKey( "Width" )) &&
(kConf->hasKey( "Balls" ))) {
i = kConf->readNumEntry( "Width" );
j = kConf->readNumEntry( "Height" );
gr->setSize( i+4, j+4 ); // +4 is the space for "lasers" and an edge...
gameBoard = new RectOnArray( gr->numC(), gr->numR() );
switch (i) {
case 8: sizesm->setItemChecked( sizes1id, TRUE ); break;
case 10: sizesm->setItemChecked( sizes2id, TRUE ); break;
case 12: sizesm->setItemChecked( sizes3id, TRUE ); break;
}
} else {
gr->setSize( 8+4, 8+4 ); // +4 is the space for "lasers" and an edge...
gameBoard = new RectOnArray( gr->numC(), gr->numR() );
sizesm->setItemChecked( sizes1id, TRUE );
}
if (kConf->hasKey( "tutorial" )) {
tutorial = (bool) kConf->readNumEntry( "tutorial" );
} else tutorial = FALSE;
options->setItemChecked( tut1id, tutorial );
QString s, s1;
int pos;
setMinSize();
gameResize();
if (kConf->hasKey( "appsize" )) {
s = kConf->readEntry( "appsize" );
debug("%s", (const char *) s);
pos = s.find( 'x' );
s1 = s.right( s.length() - pos - 1 );
s.truncate( pos - 1 );
// debug("%s", (const char *) s);
// debug("%s", (const char *) s1);
resize( s.toInt(), s1.toInt() );
}
setScore( 0 );
ballsPlaced = 0;
updateStats();
setView( gr );
newGame();
}
示例12: DWizardPage
PanoLastPage::PanoLastPage(PanoManager* const mngr, QWizard* const dlg)
: DWizardPage(dlg, i18nc("@title:window", "<b>Panorama Stitched</b>")),
d(new Private)
{
KConfig config;
KConfigGroup group = config.group("Panorama Settings");
d->mngr = mngr;
DVBox* const vbox = new DVBox(this);
d->title = new QLabel(vbox);
d->title->setOpenExternalLinks(true);
d->title->setWordWrap(true);
QVBoxLayout* const formatVBox = new QVBoxLayout();
d->saveSettingsGroupBox = new QGroupBox(i18nc("@title:group", "Save Settings"), vbox);
d->saveSettingsGroupBox->setLayout(formatVBox);
formatVBox->addStretch(1);
QLabel* const fileTemplateLabel = new QLabel(i18nc("@label:textbox", "File name template:"), d->saveSettingsGroupBox);
formatVBox->addWidget(fileTemplateLabel);
d->fileTemplateQLineEdit = new QLineEdit(QLatin1String("panorama"), d->saveSettingsGroupBox);
d->fileTemplateQLineEdit->setToolTip(i18nc("@info:tooltip", "Name of the panorama file (without its extension)."));
d->fileTemplateQLineEdit->setWhatsThis(i18nc("@info:whatsthis", "<b>File name template</b>: Set here the base name of the files that "
"will be saved. For example, if your template is <i>panorama</i> and if "
"you chose a JPEG output, then your panorama will be saved with the "
"name <i>panorama.jpg</i>. If you choose to save also the project file, "
"it will have the name <i>panorama.pto</i>."));
formatVBox->addWidget(d->fileTemplateQLineEdit);
d->savePtoCheckBox = new QCheckBox(i18nc("@option:check", "Save project file"), d->saveSettingsGroupBox);
d->savePtoCheckBox->setChecked(group.readEntry("Save PTO", false));
d->savePtoCheckBox->setToolTip(i18nc("@info:tooltip", "Save the project file for further processing within Hugin GUI."));
d->savePtoCheckBox->setWhatsThis(i18nc("@info:whatsthis", "<b>Save project file</b>: You can keep the project file generated to stitch "
"your panorama for further tweaking within "
"<a href=\"http://hugin.sourceforge.net/\">Hugin</a> by checking this. "
"This is useful if you want a different projection, modify the horizon or "
"the center of the panorama, or modify the control points to get better results."));
formatVBox->addWidget(d->savePtoCheckBox);
d->warningLabel = new QLabel(d->saveSettingsGroupBox);
d->warningLabel->hide();
formatVBox->addWidget(d->warningLabel);
d->errorLabel = new QLabel(d->saveSettingsGroupBox);
d->errorLabel->hide();
formatVBox->addWidget(d->errorLabel);
vbox->setStretchFactor(new QWidget(vbox), 2);
setPageWidget(vbox);
QPixmap leftPix(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1String("digikam/data/assistant-hugin.png")));
setLeftBottomPix(leftPix.scaledToWidth(128, Qt::SmoothTransformation));
connect(d->fileTemplateQLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(slotTemplateChanged(QString)));
connect(d->savePtoCheckBox, SIGNAL(stateChanged(int)),
this, SLOT(slotPtoCheckBoxChanged(int)));
}
示例13: kdDebug
/******************************************************************************
* 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();
}
示例14: it
void K3bCddbOptionTab::apply()
{
KConfig* c = kapp->config();
c->setGroup( "Cddb" );
c->writeEntry( "use remote cddb", m_checkRemoteCddb->isChecked() );
c->writeEntry( "use local cddb query", m_checkUseLocalCddb->isChecked() );
c->writeEntry( "save cddb entries locally", m_checkSaveLocalEntries->isChecked() );
c->writeEntry( "use manual cgi path", m_checkManualCgiPath->isChecked() );
c->writeEntry( "cgi path", m_editManualCgiPath->text() );
QStringList cddbServer;
QStringList localCddbDirs;
QListViewItemIterator it( m_viewLocalDir );
while( it.current() ) {
localCddbDirs.append( it.current()->text(0) );
++it;
}
QListViewItemIterator it1( m_viewCddbServer );
while( it1.current() ) {
cddbServer.append( it1.current()->text(0) + " " + it1.current()->text(1) + ":" + it1.current()->text(2) );
++it1;
}
// new config
c->writeEntry( "cddb server", cddbServer );
// old config <= 0.7.3
if( c->hasKey( "http server" ) )
c->deleteEntry( "http server" );
if( c->hasKey( "cddbp server" ) )
c->deleteEntry( "cddbp server" );
c->writePathEntry( "local cddb dirs", localCddbDirs );
}
示例15: m_arrangement
DolphinIconsViewSettings::DolphinIconsViewSettings(DolphinIconsView::LayoutMode mode) :
m_arrangement(QIconView::LeftToRight),
m_layoutMode(mode),
m_iconSize(KIcon::SizeMedium),
m_previewSize(KIcon::SizeMedium),
m_gridWidth(0),
m_gridHeight(KIcon::SizeMedium),
m_gridSpacing(8),
m_fontSize(0),
m_textlinesCount(2)
{
KConfig* config = kapp->config();
setConfigGroup(config);
// read icon size
m_iconSize = config->readNumEntry("Icon Size", -1);
if (m_iconSize < 0) {
m_iconSize = KIcon::SizeMedium;
}
// read arrangement
const QString arrangement(config->readEntry("Arrangement"));
if (arrangement == "Left to Right") {
m_arrangement = QIconView::LeftToRight;
}
else if (arrangement == "Top to Bottom") {
m_arrangement = QIconView::TopToBottom;
}
// read preview size, grid width and grid height
m_previewSize = config->readNumEntry("Preview Size", -1);
m_gridWidth = config->readNumEntry("Grid Width", -1);
m_gridHeight = config->readNumEntry("Grid Height", -1);
m_gridSpacing = config->readNumEntry("Grid Spacing", -1);
if (mode == DolphinIconsView::Previews) {
if (m_previewSize < 0) {
m_previewSize = KIcon::SizeEnormous;
}
if (m_gridWidth < 0) {
m_gridWidth = m_previewSize + (m_previewSize / 2);
}
}
else if (m_gridWidth < 0) {
m_gridWidth = m_iconSize + (m_iconSize / 2) + (KIcon::SizeLarge * 2);
}
if (m_gridHeight < 0) {
m_gridHeight = m_iconSize * 2;
}
// read font size and font family
m_fontSize = config->readNumEntry("Font Size", -1);
m_fontFamily = config->readEntry("Font Family");
const QFont font(KGlobalSettings::generalFont());
if (m_fontSize < 0) {
m_fontSize = font.pointSize();
}
if (m_fontFamily.isEmpty()) {
m_fontFamily = font.family();
}
// read textlines count
m_textlinesCount = config->readNumEntry("Number of Textlines", 2);
}