void kSwarmSaver::readSettings() { KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "Settings" ); QString str; str = config->readEntry( "Speed" ); if ( !str.isNull() ) speed = MAXSPEED - atoi( str ); else speed = DEFSPEED; str = config->readEntry( "MaxLevels" ); if ( !str.isNull() ) maxLevels = atoi( str ); else maxLevels = DEFBATCH; }
void KMixApplet::loadConfig() { kdDebug(67100) << "KMixApplet::loadConfig()" << endl; KConfig *cfg = this->config(); cfg->setGroup(0); _mixerId = cfg->readEntry( "Mixer", "undef" ); _mixerName = cfg->readEntry( "MixerName", QString::null ); _customColors = cfg->readBoolEntry( "ColorCustom", false ); _colors.high = cfg->readColorEntry("ColorHigh", &highColor); _colors.low = cfg->readColorEntry("ColorLow", &lowColor); _colors.back = cfg->readColorEntry("ColorBack", &backColor); _colors.mutedHigh = cfg->readColorEntry("ColorMutedHigh", &mutedHighColor); _colors.mutedLow = cfg->readColorEntry("ColorMutedLow", &mutedLowColor); _colors.mutedBack = cfg->readColorEntry("ColorMutedBack", &mutedBackColor); loadConfig( cfg, "Widget"); }
void AStylePart::loadGlobal() { // kdDebug(9009) << "Load global"<<endl; KConfig *config = kapp->config(); config->setGroup("AStyle"); QString options = config->readEntry("Options","BlockBreak=0,BlockBreakAll=0,BlockIfElse=0,Brackets=Break,BracketsCloseHeaders=0,FStyle=UserDefined,Fill=Tabs,FillCount=4,FillEmptyLines=0,FillForce=0,IndentBlocks=0,IndentBrackets=0,IndentCases=0,IndentClasses=1,IndentLabels=1,IndentNamespaces=1,IndentPreprocessors=0,IndentSwitches=1,KeepBlocks=1,KeepStatements=1,MaxStatement=40,MinConditional=-1,PadOperators=0,PadParenthesesIn=1,PadParenthesesOut=1,PadParenthesesUn=1,"); m_globalExtensions=QStringList::split(",",config->readEntry("Extensions",defaultFormatExtensions)); QStringList pairs = QStringList::split( ",", options); QStringList::Iterator it; for ( it = pairs.begin(); it != pairs.end(); ++it ) { QStringList bits = QStringList::split( "=", (*it) ); m_global[bits[0]] = bits[1]; } // for (QMap<QString, QVariant>::iterator iter = m_global.begin();iter != m_global.end();iter++) // { // kdDebug(9009) << "load: " <<iter.key() << "="<< iter.data() << endl; // } }
void Modes::loadFromConfig(KConfig &theConfig) { clear(); int numModes = theConfig.readNumEntry("Modes"); for(int i = 0; i < numModes; i++) { add(Mode().loadFromConfig(theConfig, i)); } for(iterator i = begin(); i != end(); ++i) theDefaults[i.key()] = theConfig.readEntry("Default" + i.key()); }
//----------------------------------------------------------------------------- void KMIdentity::readConfig(void) { KConfig* config = kapp->getConfig(); struct passwd* pw; char str[80]; int i; config->setGroup("Identity"); mFullName = config->readEntry("Name"); if (mFullName.isEmpty()) { pw = getpwuid(getuid()); if (pw) { mFullName = pw->pw_gecos; mFullName.detach(); i = mFullName.find(','); if (i>0) mFullName.truncate(i); } } mEmailAddr = config->readEntry("Email Address"); if (mEmailAddr.isEmpty()) { pw = getpwuid(getuid()); if (pw) { gethostname(str, 79); mEmailAddr = QString(pw->pw_name) + "@" + str; mEmailAddr.detach(); } } mOrganization = config->readEntry("Organization"); mReplyToAddr = config->readEntry("Reply-To Address"); mSignatureFile = config->readEntry("Signature File"); }
QString KProtocolManager::proxyFor(const QString &protocol) { QString scheme = protocol.lower(); if(scheme == "webdav") scheme = "http"; else if(scheme == "webdavs") scheme = "https"; KConfig *cfg = config(); cfg->setGroup("Proxy Settings"); return cfg->readEntry(scheme + "Proxy"); }
void WStreamAdd::loadSettings() { KConfig * conf = new KSimpleConfig(configName()); conf->setGroup("main"); comboBox1->setCurrentItem(conf->readUnsignedNumEntry("type", 1)); kIntNumInput1->setValue(conf->readUnsignedNumEntry("port", 5000)); kLineEdit1->setText(conf->readEntry("host", "")); slider1->setValue(conf->readUnsignedNumEntry("package", 1)); kIntNumInput2->setValue(conf->readUnsignedNumEntry("length", 40)); checkBox1->setChecked(conf->readBoolEntry("len_rnd", false)); kIntNumInput3->setValue(conf->readUnsignedNumEntry("cov", 8)); checkBox2->setChecked(conf->readBoolEntry("cov_rnd", false)); kLineEdit2->setText(conf->readEntry("filename", "")); checkBox3->setChecked(conf->readBoolEntry("reloop", false)); delete conf; typeChanged(); }
void kRockSetup::readSettings() { KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "Settings" ); QString str; str = config->readEntry( "Speed" ); if ( !str.isNull() ) speed = atoi( str ); if ( speed > 100 ) speed = 100; else if ( speed < 50 ) speed = 50; str = config->readEntry( "Number" ); if ( !str.isNull() ) number = atoi( str ); if ( number > 260 ) number = 260; else if ( speed < 50 ) number = 50; str = config->readEntry( "Move" ); if ( !str.isNull() && str.find( "yes" ) == 0 ) move = TRUE; else move = FALSE; str = config->readEntry( "Rotate" ); if ( !str.isNull() && str.find( "yes" ) == 0 ) rotate = TRUE; else rotate = FALSE; }
Trigger_list::Trigger_list(KConfig &cfg_P, Action_data *data_P) : QPtrList< Trigger >() { setAutoDelete(true); _comment = cfg_P.readEntry("Comment"); QString save_cfg_group = cfg_P.group(); int cnt = cfg_P.readNumEntry("TriggersCount", 0); for(int i = 0; i < cnt; ++i) { cfg_P.setGroup(save_cfg_group + QString::number(i)); Trigger *trigger = Trigger::create_cfg_read(cfg_P, data_P); if(trigger) append(trigger); } cfg_P.setGroup(save_cfg_group); }
void ThemeStandard::_readSettings() { if ( !mTheme ) return; KConfig *cfg = mTheme->themeConfig(); if ( !cfg ) return; //if ( !cfg->hasGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ) ) // return; cfg->setGroup( QString("KSplash Theme: %1").arg(mTheme->theme()) ); QString sbpos = cfg->readEntry( "Statusbar Position", "Bottom" ).upper(); mSbAtTop = ( sbpos == "TOP" ); mSbVisible = cfg->readBoolEntry( "Statusbar Visible", true); mSbPbVisible = cfg->readBoolEntry( "Progress Visible", true); mSbFontName = cfg->readEntry( "Statusbar Font", "Sans Serif" ); mSbFontSz = cfg->readNumEntry( "Statusbar Font Size", 16 ); mSbFontBold = cfg->readBoolEntry( "Statusbar Font Bold", true ); mSbFontItalic = cfg->readBoolEntry( "Statusbar Font Italic", false ); mSbFont = QFont( mSbFontName, mSbFontSz, ( mSbFontBold? QFont::Bold : QFont::Normal ) ); if( mSbFontItalic ) mSbFont.setItalic( true ); mSbFg = cfg->readColorEntry( "Statusbar Foreground", &Qt::white ); mSbBg = cfg->readColorEntry( "Statusbar Background", &Qt::black ); mSbIcon = cfg->readEntry( "Statusbar Icon", "run" ); mIconsVisible = cfg->readBoolEntry( "Icons Visible", true); mIconsJumping = cfg->readBoolEntry( "Icons Jumping", true); mIconPos = (WndIcon::Position)cfg->readNumEntry( "Icon Position", 0 ); mSplashScreen = cfg->readEntry( "Splash Screen", "(Default)"); // cfg->readBoolEntry( "Allow Configuration", true ); }
void kSpaceSaver::readSettings() { KConfig *config = klock_config(); config->setGroup( "Settings" ); TQString str; str = config->readEntry( "Speed" ); if ( !str.isNull() ) speed = MAXSPEED - str.toInt(); else speed = DEFSPEED; warpinterval = config->readNumEntry( "WarpInterval", 15 ); delete config; }
void KfmView::slotTerminal() { KConfig *config = KApplication::getKApplication()->getConfig(); config->setGroup( "KFM Misc Defaults" ); QString term = config->readEntry( "Terminal", DEFAULT_TERMINAL ); QString dir ( QDir::homeDirPath() ); KURL u( manager->getURL() ); if ( strcmp( u.protocol(), "file" ) == 0 && !u.hasSubProtocol() ) dir = u.path(); QString cmd; cmd << "cd \"" << dir << "\" ; " << term << "&"; system( cmd.data() ); }
static bool startArts() { KConfig *config = new KConfig("kcmartsrc", true, false); config->setGroup("Arts"); bool startServer = config->readBoolEntry("StartServer",true); bool startRealtime = config->readBoolEntry("StartRealtime",true); QString args = config->readEntry("Arguments","-F 10 -S 4096 -s 60 -m artsmessage -c drkonqi -l 3 -f"); delete config; if (startServer) kapp->kdeinitExec(startRealtime?"artswrapper":"artsd", QStringList::split(" ",args)); return startServer; }
SigGenerator::SigGenerator() { QString dir = KGlobal::dirs()->saveLocation("appdata"); QFile file(dir + "sigs.sigml"); if(file.open(IO_ReadOnly) && doc.setContent(&file)) { signatures = doc.elementsByTagName("signature"); file.close(); } KConfig *config = KGlobal::config(); { KConfigGroupSaver saver(config, "Settings"); header = config->readEntry("Header"); footer = config->readEntry("Footer"); } }
QString buildPixmap(const QString &name, KConfig &input, const QString &iconPath) { input.setGroup(name); QString cleanName = name.lower().replace(":", "_"); QString iconName = input.readEntry("IconSet", cleanName + ".png"); QFileInfo fi(iconPath + "/" + iconName); QImage pix(fi.absFilePath()); QCString xpm; QBuffer buff(xpm); buff.open(IO_WriteOnly); QImageIO io(&buff, "XPM"); io.setFileName(cleanName + "_xpm"); io.setImage(pix); io.write(); buff.close(); return xpm; }
void UploadDialog::setPayloadFile(const QString &payloadFile) { mPayloadUrl = payloadFile; KConfig *conf = kapp->config(); conf->setGroup(QString("KNewStuffUpload:%1").arg(mPayloadUrl.fileName())); QString name = conf->readEntry("name"); QString author = conf->readEntry("author"); QString email = conf->readEntry("email"); QString version = conf->readEntry("version"); QString release = conf->readEntry("release"); QString preview = conf->readEntry("preview"); QString summary = conf->readEntry("summary"); QString lang = conf->readEntry("language"); QString licence = conf->readEntry("licence"); mNameEdit->clear(); mAuthorEdit->clear(); mEmailEdit->clear(); mVersionEdit->clear(); mReleaseSpin->setValue(1); mPreviewUrl->clear(); mSummaryEdit->clear(); mLanguageCombo->setCurrentItem(0); mLicenceCombo->setCurrentItem(0); if(!name.isNull()) { int prefill = KMessageBox::questionYesNo(this, i18n("Old upload information found, fill out fields?"), QString::null, i18n("Fill Out"), i18n("Do Not Fill Out")); if(prefill == KMessageBox::Yes) { mNameEdit->setText(name); mAuthorEdit->setText(author); mEmailEdit->setText(email); mVersionEdit->setText(version); mReleaseSpin->setValue(release.toInt()); mPreviewUrl->setURL(preview); mSummaryEdit->setText(summary); if(!lang.isEmpty()) mLanguageCombo->setCurrentText(lang); if(!licence.isEmpty()) mLicenceCombo->setCurrentText(licence); } } }
int main(int argc, char **argv) { // question -- should we log errors w/syslog? Since we // are a daemon, the printf's aren't really going anywhere... if (signal(SIGINT, sighandler) == SIG_ERR) debug("warning, can't catch SIGINT"); if (signal(SIGTERM, sighandler) == SIG_ERR) debug("warning, can't catch SIGTERM"); if (signal(SIGHUP, sighandler) == SIG_ERR) debug("warning, can't catch SIGHUP"); if (signal(SIGUSR1, sighandler) == SIG_ERR) debug("warning, can't catch SIGUSR1"); // Only start up if we aren't running already. // initDaemon will exit if another is already running initDaemon(); KApplication app(argc, argv, "alarmd"); // if no filename is supplied, read from config file. if (argc < 2) { QString cfgPath = KApplication::localconfigdir(); cfgPath += "/korganizerrc"; KConfig *config = new KConfig(cfgPath.data()); config->setGroup("General"); QString newFileName = config->readEntry("Current Calendar"); delete config; ad = new AlarmDaemon(newFileName.data()); } else ad = new AlarmDaemon(argv[1]); ad->dock(); app.enableSessionManagement(TRUE); app.setTopWidget(new QWidget); app.exec(); delete ad; return 0; }
/** * read the configfile */ void PingCfgDlg::readConfig() { QString s; KConfig *kc = kapp->getConfig(); kc->setGroup(configGroupName); if (kc->hasKey("binaryType")) { s = kc->readEntry("binaryType"); if (!stricmp(s, "nslookup")) { cfgNslookupBtn->setChecked(TRUE); } else { cfgPingBtn->setChecked(TRUE); } } else { cfgPingBtn->setChecked(TRUE); } }
QString buildWidgetDef(const QString &name, KConfig &input, const QString &group) { input.setGroup(name); QMap< QString, QString > defMap; defMap.insert("Group", input.readEntry("Group", group).replace("\"", "\\\"")); defMap.insert("IconSet", input.readEntry("IconSet", name.lower() + ".png").replace(":", "_")); defMap.insert("Pixmap", name.lower().replace(":", "_") + "_xpm"); defMap.insert("IncludeFile", input.readEntry("IncludeFile", name.lower() + ".h").remove(":")); defMap.insert("ToolTip", input.readEntry("ToolTip", name + " Widget").replace("\"", "\\\"")); defMap.insert("WhatsThis", input.readEntry("WhatsThis", name + " Widget").replace("\"", "\\\"")); defMap.insert("IsContainer", input.readEntry("IsContainer", "false")); defMap.insert("Class", name); return KMacroExpander::expandMacros(widgetDef, defMap); }
/** * checkBinary */ void CommandDlg::checkBinaryAndDisplayWidget() { //debug("%s::checkBinaryAndDisplayWidget()", name()); KConfig *kc = kapp->getConfig(); kc->setGroup(configGroupName); if (::test_for_exec(kc->readEntry("path"))) { commandFound = TRUE; } else { commandFound = FALSE; } if (commandFound) { commandBinNonOK->hide(); commandBinOK->show(); } else { commandBinOK->hide(); commandBinNonOK->show(); } }
QCursor KCursor::handCursor() { static QCursor *hand_cursor = 0; if (!hand_cursor) { KConfig *config = KGlobal::config(); KConfigGroupSaver saver( config, "General" ); #ifndef Q_WS_WIN // this mask doesn't work too well on win32 if ( config->readEntry("handCursorStyle", "Windows") == "Windows" ) { static const unsigned char HAND_BITS[] = { 0x80, 0x01, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x02, 0x00, 0x40, 0x1e, 0x00, 0x40, 0xf2, 0x00, 0x40, 0x92, 0x01, 0x70, 0x92, 0x02, 0x50, 0x92, 0x04, 0x48, 0x80, 0x04, 0x48, 0x00, 0x04, 0x48, 0x00, 0x04, 0x08, 0x00, 0x04, 0x08, 0x00, 0x04, 0x10, 0x00, 0x04, 0x10, 0x00, 0x04, 0x20, 0x00, 0x02, 0x40, 0x00, 0x02, 0x40, 0x00, 0x01, 0xc0, 0xff, 0x01}; static const unsigned char HAND_MASK_BITS[] = { 0x80, 0x01, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x03, 0x00, 0xc0, 0x1f, 0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x01, 0xf0, 0xff, 0x03, 0xf0, 0xff, 0x07, 0xf8, 0xff, 0x07, 0xf8, 0xff, 0x07, 0xf8, 0xff, 0x07, 0xf8, 0xff, 0x07, 0xf8, 0xff, 0x07, 0xf0, 0xff, 0x07, 0xf0, 0xff, 0x07, 0xe0, 0xff, 0x03, 0xc0, 0xff, 0x03, 0xc0, 0xff, 0x01, 0xc0, 0xff, 0x01}; QBitmap hand_bitmap(22, 22, HAND_BITS, true); QBitmap hand_mask(22, 22, HAND_MASK_BITS, true); hand_cursor = new QCursor(hand_bitmap, hand_mask, 7, 0); // Hack to force QCursor to call XCreatePixmapCursor() immediately // so the bitmaps don't get pushed out of the Xcursor LRU cache. hand_cursor->handle(); } else #endif //! Q_WS_WIN hand_cursor = new QCursor(PointingHandCursor); } Q_CHECK_PTR(hand_cursor); return *hand_cursor; }
DolphinDetailsViewSettings::DolphinDetailsViewSettings() : m_columnEnabled(0), m_iconSize(0), m_fontSize(0) { KConfig* config = kapp->config(); config->setGroup("Details Mode"); // read which columns should be shown const bool showName = config->readBoolEntry("Show Name", true); const bool showSize = config->readBoolEntry("Show Size", true); const bool showDate = config->readBoolEntry("Show Date", true); const bool showPermissions = config->readBoolEntry("Show Permissions", false); const bool showOwner = config->readBoolEntry("Show Owner", false); const bool showGroup = config->readBoolEntry("Show Group", false); setColumnEnabled(DolphinDetailsView::NameColumn, showName); setColumnEnabled(DolphinDetailsView::SizeColumn, showSize); setColumnEnabled(DolphinDetailsView::DateColumn, showDate); setColumnEnabled(DolphinDetailsView::PermissionsColumn, showPermissions); setColumnEnabled(DolphinDetailsView::OwnerColumn, showOwner); setColumnEnabled(DolphinDetailsView::GroupColumn, showGroup); // read icon size m_iconSize = config->readNumEntry("Icon Size", KIcon::SizeSmall); // 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(); } }
void MainWidget::readSettings( ) { m_htmlWidget->readSettings( ); KConfig* config = kapp->config( ); config->setGroup( "General" ); m_stylesheetURLs = config->readListEntry( "stylesheetURLs" ); m_useLocalManPage = config->readBoolEntry( "useLocalManPage", false ); m_wrapText = config->readBoolEntry( "wrapText", false ); QValueList<int> splitterSizes = config->readIntListEntry( "splitterSizes" ); setSizes( splitterSizes ); QStringList scanNames = config->readListEntry( "scanNames" ); if( !scanNames.count( )) scanNames.append( "default" ); QString visibleScanName = config->readEntry( "visibleScan", QString::null ); ScanWidget* visibleScanWidget = NULL; for( QStringList::Iterator it = scanNames.begin( ); it != scanNames.end(); ++it ) { ScanWidget* scanWidget = createScan( *it, false, QString::null ); if( visibleScanName == scanWidget->scanName( )) visibleScanWidget = scanWidget; } if( visibleScanWidget == NULL ) { visibleScanWidget = m_scanStack->firstScanWidget( ); if( visibleScanWidget == NULL ) { KMessageBox::error( this, i18n( "Internal error - no ScanWidget to display!" ), i18n( "Internal error" )); kapp->quit( ); } } m_scanStack->raiseWidget( visibleScanWidget ); }
//----------------------------------------------------------------------------- void KMAcctMgr::readConfig(void) { KConfig* config = app->getConfig(); KMAccount* acct; QString groupName(256), acctType, acctName; int i, num; mAcctList.clear(); config->setGroup("General"); num = config->readNumEntry("accounts", 0); for (i=1; i<=num; i++) { groupName.sprintf("Account %d", i); config->setGroup(groupName); acctType = config->readEntry("Type"); acctName = config->readEntry("Name"); acct = create(acctType, acctName); if (!acct) continue; acct->readConfig(*config); } }
/** based on code in kaction.cpp */ void KEducaEditorStartDialog::buildRecentFilesList() { QString key; QString value; QString oldGroup; KConfig *config = KGlobal::config(); oldGroup = config->group(); config->setGroup( "RecentFiles" ); // read file list for( unsigned int i = 1 ; i <= _maxRecentDocumentItems ; i++ ) { key = QString( "File%1" ).arg( i ); value = config->readEntry( key, QString::null ); if (!value.isNull()) recentDocumentCB->insertURL( KURL(value) ); } config->setGroup( oldGroup ); }
SpellDlg::SpellDlg(bool haveMarkedText,QWidget *parent,const char *name) : KDialogBase(parent,name,true,i18n("Caption of dialog","Spelling") , Ok|Cancel) { setButtonOK(KGuiItem(i18n("&Spell Check"),"spellcheck")); _mainWidget = new SpellDlgWidget(this); setMainWidget(_mainWidget); if(haveMarkedText) { _mainWidget->markedBtn->setChecked(true); _mainWidget->defaultBtn->setChecked(false); _mainWidget->defaultBtn->setEnabled(false); } else { _mainWidget->markedBtn->setEnabled(false); KConfig *config = KGlobal::config(); KConfigGroupSaver cs(config,"SpellDlg"); QString what=config->readEntry("Default","All"); if(what=="All") _mainWidget->allBtn->setChecked(true); else if(what=="Current") _mainWidget->currentBtn->setChecked(true); else if(what=="Begin") _mainWidget->beginBtn->setChecked(true); else if(what=="End") _mainWidget->endBtn->setChecked(true); else _mainWidget->allBtn->setChecked(true); } }
void KIconLoader::initPath() { // DF ---- Large icons -------------- // set the key depending on the current application QString key = "KDE"; if (strcmp( kapp->name(), "kpanel" ) == 0) key = "kpanel"; if (strcmp( kapp->name(), "kfm" ) == 0) key = "kfm"; KConfig config; // read .kderc config.setGroup("KDE"); QString setting = config.readEntry( key + "IconStyle", "Normal" ); //debug("App is %s - setting is %s", kapp->name(), setting.data()); // DF // order is important! -- Bernd // higher priority at the end addPath( KApplication::kde_toolbardir() ); addPath( KApplication::kde_icondir() ); if (setting == "Large") addPath( KApplication::kde_icondir() + "/large" ); addPath( KApplication::localkdedir() + "/share/toolbar" ); addPath( KApplication::localkdedir() + "/share/icons" ); if (setting == "Large") addPath( KApplication::localkdedir() + "/share/icons/large" ); addPath( KApplication::kde_datadir() + "/" + kapp->appName() + "/toolbar" ); addPath( KApplication::localkdedir() + "/share/apps/" + kapp->appName() + "/toolbar" ); addPath( KApplication::kde_datadir() + "/" + kapp->appName() + "/pics" ); if (setting == "Large") addPath( KApplication::kde_datadir() + "/" + kapp->appName() + "/pics/large" ); addPath( KApplication::localkdedir() + "/share/apps/" + kapp->appName() + "/pics" ); if (setting == "Large") addPath( KApplication::localkdedir() + "/share/apps/" + kapp->appName() + "/pics/large" ); }
Kandy::Kandy(CommandScheduler *scheduler) : KMainWindow(0, "Kandy"), mPrinter(0) { mScheduler = scheduler; mPreferencesDialog = 0; mView = new KandyView(mScheduler, this); // accept dnd setAcceptDrops(true); // tell the KMainWindow that this is indeed the main widget setCentralWidget(mView); // then, setup our actions setupActions(); statusBar()->insertItem(i18n(" Disconnected "), 0, 0, true); setAutoSaveSettings(); // allow the view to change the statusbar and caption connect(mView, SIGNAL(signalChangeStatusbar(const QString &)), this, SLOT(changeStatusbar(const QString &))); connect(mView, SIGNAL(signalChangeCaption(const QString &)), this, SLOT(changeCaption(const QString &))); connect(mView, SIGNAL(modifiedChanged(bool)), SLOT(setTitle())); KConfig *config = KGlobal::config(); config->setGroup("General"); QString currentProfile = config->readEntry("CurrentProfile", locate("appdata", "default.kandy")); if(!currentProfile.isEmpty()) load(currentProfile); }
void KGlobalAccel::readSettings() { QString s; KConfig *pConfig = kapp->getConfig(); pConfig->setGroup( aGroup.data() ); QDictIterator<KKeyEntry> aKeyIt( aKeyDict ); aKeyIt.toFirst(); #define pE aKeyIt.current() while ( pE ) { s = pConfig->readEntry( aKeyIt.currentKey() ); if ( s.isNull() ) pE->aConfigKeyCode = pE->aDefaultKeyCode; else pE->aConfigKeyCode = stringToKey( s.data() ); if ( pE->bEnabled ) { uint keysym = keyToXSym( pE->aCurrentKeyCode ); uint mod = keyToXMod( pE->aCurrentKeyCode ); ungrabKey( keysym, mod ); } pE->aCurrentKeyCode = pE->aConfigKeyCode; if ( pE->bEnabled ) { uint keysym = keyToXSym( pE->aCurrentKeyCode ); uint mod = keyToXMod( pE->aCurrentKeyCode ); grabKey( keysym, mod ); } ++aKeyIt; } #undef pE }
void GUIClient::registerToolView (ToolView *tv) { QString aname = QString("kate_mdi_toolview_") + tv->id; // try to read the action shortcut KShortcut sc; KConfig *cfg = kapp->config(); QString _grp = cfg->group(); cfg->setGroup("Shortcuts"); sc = KShortcut( cfg->readEntry( aname, "" ) ); cfg->setGroup( _grp ); KToggleAction *a = new ToggleToolViewAction(i18n("Show %1").arg(tv->text), sc,tv, actionCollection(), aname.latin1() ); a->setCheckedState(i18n("Hide %1").arg(tv->text)); m_toolViewActions.append(a); m_toolMenu->insert(a); m_toolToAction.insert (tv, a); updateActions(); }