KSimPackageFileWidget::KSimPackageFileWidget(QWidget *parent, const char *name ) : PropertyWidget(1, parent,name) { setMargin(0); m_directories = new KSimDirectorySelector(this, "Package directories"); m_directories->setTitle(i18n("Package directories:")); m_directories->setStartDir(QString::fromLatin1(":<KSimPackageFile>")); m_files = new KSimFileListSelector(this, "Package files"); m_files->setTitle(i18n("Package files:")); m_files->setFilter(i18n("*.so|Package files (*.so)\n*|All files (*)")); m_files->setStartDir(QString::fromLatin1(":<KSimPackageFile>")); // Setup data KConfig * config = kapp->config(); QString group(config->group()); config->setGroup("Packages"); QStringList dirList; m_dirList = config->readListEntry("Directories"); m_fileList = config->readListEntry("Files"); config->setGroup(group); m_directories->setFileList(m_dirList); m_files->setFileList(m_fileList); }
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(); }
void PageServChan::readConfig( const KSOServChan * ) { KConfig *conf = kapp->config(); conf->setGroup("ServerList"); QStringList recent = conf->readListEntry("RecentServers"); recent.sort(); serverLB->insertStringList(recent); conf->setGroup("Recent"); recent = conf->readListEntry("Channels"); recent.sort(); channelLB->insertStringList(recent); }
void MyFracWindow::readParameters() { KConfig* config = kapp->config(); config->setGroup("Parameters"); _sliderIterations->setValue(config->readNumEntry("Iterations", 2)); _sliderQuality->setValue(config->readNumEntry("Quality", 5)); _sliderScale->setValue(config->readNumEntry("Scale", 15)); _sliderOffset->setValue(config->readNumEntry("Offset", 0)); _sliderScroll->setValue(config->readNumEntry("Scroll", 25)); _sliderHeight->setValue(config->readNumEntry("Height", 20)); _comboGrid->setCurrentItem(config->readNumEntry("Grid", 1)); setGridSize(_comboGrid->currentItem()); QColor black(0, 0, 0); _colorButton->setColor(config->readColorEntry("Background", &black)); QStringList list = config->readListEntry("Gradient"); if (list.size() == 4) { Gradient gradient(list[0] == "hsv"); gradient.getSpline(0).fromString(list[1]); gradient.getSpline(1).fromString(list[2]); gradient.getSpline(2).fromString(list[3]); setGradient(gradient); } else setGradient(_presets.getDefault()); QSize defSize(800, 600); _imageSize = config->readSizeEntry("ImageSize", &defSize); _imageMime = config->readEntry("ImageMime", "image/png"); _imagePath = config->readEntry("ImagePath"); }
void KLocaleConfig::loadLanguageList(KLanguageCombo *combo) { KConfig *config = kapp->getConfig(); QString name; combo->clear(); languages.clear(); tags.clear(); config->setGroup("KCM Locale"); config->readListEntry("Languages", tags); for (const char *lang = tags.first(); lang; lang = tags.next()) { config->setGroup(lang); name = config->readEntry("Name"); if (!name.isEmpty()) languages.append(name); else languages.append(klocale->translate("without name!")); combo->insertLanguage(QString(lang)+";"+name); if (strcmp(lang,"C")==0) combo->setCurrentItem(combo->count()-1); } }
NewWindowDialog::NewWindowDialog(const KSircChannel &channelInfo, QWidget * parent, const char * name) : KDialogBase(parent, name, true, i18n("New Window For"), Ok|Cancel, Ok, true), m_channelInfo(channelInfo) { QHBox * w = makeHBoxMainWidget(); QLabel * l = new QLabel(i18n("C&hannel/Nick:"), w); m_combo = new KHistoryCombo(w); m_combo->setFocus(); // we don't need duplicated channel into the list m_combo->setDuplicatesEnabled( false ); l->setBuddy(m_combo); QLabel * l2 = new QLabel(i18n("&Key:"), w); m_le = new KLineEdit(w); m_le->setEnabled(false); l2->setBuddy(m_le); connect( m_combo, SIGNAL(activated(const QString &)), m_combo, SLOT(addToHistory(const QString &))); connect( m_combo->lineEdit(), SIGNAL(textChanged ( const QString & )), this, SLOT( slotTextChanged( const QString &))); KConfig *kConfig = kapp->config(); KConfigGroupSaver saver(kConfig, "Recent"); m_combo->setHistoryItems(kConfig->readListEntry("Channels")); slotTextChanged( m_combo->lineEdit()->text()); }
void DockBarExtension::loadContainerConfig() { KConfig *conf = config(); conf->setGroup("General"); QStringList applets = conf->readListEntry("Applets"); QStringList fail_list; for(QStringList::Iterator it = applets.begin(); it != applets.end(); ++it) { if(!conf->hasGroup(*it)) continue; conf->setGroup(*it); QString cmd = conf->readPathEntry("Command"); QString resName = conf->readPathEntry("resName"); QString resClass = conf->readEntry("resClass"); if(cmd.isEmpty() || resName.isEmpty() || resClass.isEmpty()) continue; DockContainer *c = new DockContainer(cmd, this, resName, resClass); addContainer(c); KProcess proc; proc << KShell::splitArgs(cmd); if(!proc.start(KProcess::DontCare)) { fail_list.append(cmd); removeContainer(c); } } if(!fail_list.isEmpty()) KMessageBox::queuedMessageBox(0, KMessageBox::Information, i18n("The following dockbar applets could not be started: %1").arg(fail_list.join(", ")), i18n("kicker: information"), 0); saveContainerConfig(); }
void FontDialog::load() { KConfig *cfg = kapp->config(); { KConfigGroupSaver groupSaver(cfg, "HTML Settings"); m_minFontSize->setValue(cfg->readNumEntry("MinimumFontSize", HTML_DEFAULT_MIN_FONT_SIZE)); m_medFontSize->setValue(cfg->readNumEntry("MediumFontSize", 10)); QStringList fonts = cfg->readListEntry("Fonts"); if(fonts.isEmpty()) fonts << KGlobalSettings::generalFont().family() << KGlobalSettings::fixedFont().family() << HTML_DEFAULT_VIEW_SERIF_FONT << HTML_DEFAULT_VIEW_SANSSERIF_FONT << HTML_DEFAULT_VIEW_CURSIVE_FONT << HTML_DEFAULT_VIEW_FANTASY_FONT; m_standardFontCombo->setCurrentFont(fonts[0]); m_fixedFontCombo->setCurrentFont(fonts[1]); m_serifFontCombo->setCurrentFont(fonts[2]); m_sansSerifFontCombo->setCurrentFont(fonts[3]); m_italicFontCombo->setCurrentFont(fonts[4]); m_fantasyFontCombo->setCurrentFont(fonts[5]); m_defaultEncoding->setCurrentItem(cfg->readEntry("DefaultEncoding")); m_fontSizeAdjustement->setValue(fonts[6].toInt()); } }
void KatapultSettings::readSettings() { KConfig *config = kapp->config(); _hideSessionNotification = config->readNumEntry("HideSessionNotification", 1); _hideUserNotification = config->readNumEntry("HideUserNotification", 0); _notificationTimeout = config->readNumEntry("NotificationTimeout", 5000); _hideDelay = config->readUnsignedNumEntry("HideDelay", 1000); _noResultsDelay = config->readUnsignedNumEntry("NoResultsDelay", 2500); _noResultsAction = (NRAction) config->readUnsignedNumEntry("NoResultsAction", NR_ClearQuery); _systrayIcon = config->readBoolEntry("SystrayIcon", TRUE); _autoExec = config->readBoolEntry("AutoExec", FALSE); _displayName = config->readEntry("Display", "Pure Display"); if (_displayName == "Name=Glass Display") { _displayName = "Glass Display"; } QStringList defCatalogs; defCatalogs << "Program Catalog" << "Bookmark Catalog" << "Document Catalog" << "Calculator Catalog" << "Amarok Catalog" << "Spell Catalog" << "Google Catalog" << "Execution Catalog"; _activeCatalogNames = config->readListEntry("Catalogs", defCatalogs); // Force a config write if notification is to be shown once. // (in writeSettings(), _hideSessionNotification or _hideUserNotification // is changed before writing [if necessary]). _forceWrite = ((kapp->isSessionRestored() && _hideSessionNotification == 1) || (!kapp->isSessionRestored() && _hideUserNotification == 1)); }
KIconTemplateContainer::KIconTemplateContainer() : QObject() { QString path; instances++; debug("KIconTemplateContainer: instances %d", instances); if(templatelist) return; debug("KIconTemplateContainer: Creating templates"); templatelist = new QList<KIconTemplate>; templatelist->setAutoDelete(true); QStrList names; KConfig *k = kapp->getConfig(); k->setGroup("Templates"); k->readListEntry("Names", names); for(int i = 0; i < (int)names.count(); i++) { KIconTemplate *it = new KIconTemplate; it->path = k->readEntry(names.at(i)); it->title = names.at(i); //debug("Template: %s\n%s", names.at(i), path.data()); templatelist->append(it); } if(templatelist->count() == 0) { createStandardTemplates(templatelist); } }
void PageAutoConnect::readConfig() { KConfig *conf = kapp->config(); conf->setGroup("AutoConnect"); QStringList servers = conf->readListEntry("Servers"); servers.sort(); QStringList::ConstIterator ser = servers.begin(); for( ; ser != servers.end(); ser++){ QStringList channels = conf->readListEntry(*ser); QString server = *ser; QString port = "6667"; QString ssl = QString::null; QString pass = QString::null; QRegExp rx("(.+) \\(SSL\\)(.*)"); if(rx.search(server) >= 0){ server = rx.cap(1) + rx.cap(3); ssl = i18n("SSL"); } rx.setPattern("(.+) \\(pass: (\\S+)\\)(.*)"); if(rx.search(server) >= 0){ server = rx.cap(1) + rx.cap(3); pass = rx.cap(2); } rx.setPattern("([^: ]+):(\\d+)"); if(rx.search(server) >= 0){ kdDebug(5008) << server << ": Has port:" << rx.cap(2) << endl; server = rx.cap(1); port = rx.cap(2); } kdDebug(5008) << server << ": Done " << port << " " << ssl << " " << pass << endl; QListViewItem *s = new QListViewItem(KLVAutoConnect, server, port, pass, ssl); s->setOpen(TRUE); channels.sort(); QStringList::ConstIterator chan = channels.begin(); for(; chan != channels.end(); chan++){ QString channel = *chan; QString key = QString::null; QRegExp crx("(.+) \\(key: (\\S+)\\)"); if(crx.search(channel) >= 0){ channel = crx.cap(1); key = crx.cap(2); } new QListViewItem(s, channel, key); } } }
KPartSaver::KPartSaver( WId id ) : KScreenSaver( id ), m_timer(), m_part(0), m_current(-1), m_back(0) { // install signal handlers to make sure that nspluginviewer is shutdown correctly // move this into the nspluginviewer kpart code if( !g_inited ) { g_inited = true; g_savers.setAutoDelete( true ); srand( time(0) ); // install signal handler signal( SIGINT, exitHandler ); // Ctrl-C will cause a clean exit... signal( SIGTERM, exitHandler ); // "kill"... signal( SIGHUP, exitHandler ); // "kill -HUP" (hangup)... signal( SIGKILL, exitHandler ); // "kill -KILL" //atexit( ( void (*)(void) ) exitHandler ); } g_savers.append( this ); closeURL(); // load config KConfig *cfg = kapp->config(); cfg->setGroup( "Misc" ); m_single = cfg->readBoolEntry( "Single", true ); m_delay = cfg->readNumEntry( "Delay", 60 ); m_random = cfg->readBoolEntry( "Random", false ); m_files = cfg->readListEntry( "Files" ); if( m_files.count()==0 ) { // create background widget m_back = new TQLabel( i18n("The screen saver is not configured yet."), this ); m_back->tqsetAlignment( AlignCenter ); embed( m_back ); m_back->show(); } else { // queue files for( unsigned int n=0; n<m_files.count(); n++ ) queue( KURL::fromPathOrURL( m_files[n] ) ); // play files if( m_single ) next( m_random ); else { next( m_random ); m_timer = new TQTimer( this ); m_timer->start( m_delay*1000, true ); connect( m_timer, TQT_SIGNAL(timeout()), TQT_SLOT(timeout()) ); } } }
bool KHost::ReadConfig() { KConfig *config = ((KConnection*) topLevelWidget())->GetConfig(); QStrList List; const char *Value; int i; if (config == NULL) return FALSE; config->setGroup(KI_SEC_HOSTS); config->readListEntry(KI_ENT_HOSTS,List); hostCombo->insertStrList(&List); List.clear(); config->readListEntry(KI_ENT_PORTS,List); portCombo->insertStrList(&List); Value = config->readEntry(KI_ENT_LAST_HOST); if (Value != NULL && *Value != '\0') for (i = 0; i < hostCombo->count(); i++) if (!strcmp(Value,hostCombo->text(i))) { hostCombo->setCurrentItem(i); break; } Value = config->readEntry(KI_ENT_LAST_PORT); if (Value != NULL && *Value != '\0') for (i = 0; i < portCombo->count(); i++) if (!strcmp(Value,portCombo->text(i))) { portCombo->setCurrentItem(i); break; } hostChanged(0); portChanged(0); return TRUE; }
KAArchieSettings::KAArchieSettings(const char *title, QWidget *parent, const char *name) :QGroupBox( title, parent, name ) { // debug( "set KAArchieSettings Combobox" ); hostbox = new QGroupBox( this, "hostbox" ); hostbox->setFrameStyle( QFrame::NoFrame ); hostname = new QComboBox( hostbox, "hostname" ); hostnamelabel = new QLabel( hostname, i18n("&Host"), hostbox, "hostnamelabel" ); timeoutbox = new QGroupBox ( this, "timeoutbox" ); timeoutbox->setFrameStyle( QFrame::NoFrame ); timeoutline = new KIntegerLine( timeoutbox, "timeoutline" ); // timeoutline->hide(); // timeoutline->setText("0000"); // get the size for displaying "0000" // const QSize lineEditSize = timeoutline->sizeHint(); // QFontMetrics *fm = &timeoutline->fontMetrics(); // int lineEditHeight = fm->boundingRect('8').height(); // timeoutline->setFixedHeight( timeoutline->height() ); // timeoutline->show(); timeoutlabel = new QLabel( timeoutline, i18n("&Timeout (seconds)"), timeoutbox, "timeoutlabel" ); connect(timeoutline, SIGNAL(returnPressed()), this, SLOT(slotRP()) ); triesbox = new QGroupBox ( this, "triesbox" ); triesbox->setFrameStyle( QFrame::NoFrame ); triesline = new KIntegerLine( triesbox, "triesline" ); // QString tmp("set KLineEdit height "); // tmp.setNum( lineEditHeight ); // debug( tmp ); // triesline->setFixedHeight( triesline->height() ); trieslabel = new QLabel( triesline, i18n("Maximal &retries"), triesbox, "trieslabel" ); connect(triesline, SIGNAL(returnPressed()), this, SLOT(slotRP()) ); doLayout(); // read initial archie server list QStrList archiehostlist; KConfig *config = KApplication::getKApplication()->getConfig(); // get the list of hosts KConfigGroupSaver saveGroup( config, "HostConfig" ); // archiehostlistnumber = config->readListEntry( "Hosts", archiehostlist ); QString defaulthost = "archie.sura.net" ; if ( archiehostlist.isEmpty() ) { archiehostlist.append( defaulthost ); // currentHostId = 0; } hostname->insertStrList( &archiehostlist ); hostname->adjustSize(); readConfig(); }
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 servercontroller::start_autoconnect_check() { KConfig *conf = kapp->config(); conf->setGroup("AutoConnect"); QStringList servers = conf->readListEntry("Servers"); if(servers.count() == 0){ KSPrefs *kp = new KSPrefs(); connect(kp, SIGNAL(update(int)), this, SLOT(configChange())); kp->resize(550, 450); kp->showPage(7); /* Show auto connect page */ kp->show(); }
QStringList Repositories::readConfigFile() { QStringList list; KConfig *config = CervisiaPart::config(); config->setGroup("Repositories"); list = config->readListEntry("Repos"); // Some people actually use CVSROOT, so we add it here char *env; if ( (env = ::getenv("CVSROOT")) != 0 && !list.contains(env)) list.append(env); return list; }
void KBabelMailer::readConfig() { // The relevant variables are never stored in catalogmanagerrc but in // project config file. Therefore they are read from the project. MiscSettings _settings = _project->miscSettings(); bzipCompression = _settings.useBzip; singleFileCompression = _settings.compressSingleFile; KConfig* conf = _project->config(); conf->setGroup ("Misc"); archiveList = conf->readListEntry("MailArchiveNames"); _poBaseDir = _project->catManSettings().poBaseDir; }
void MoodPlugin::init() { toolbar=new KToolBar((QMainWindow*)ktagebuchapp,QMainWindow::Top); new QLabel(i18n("Mood :"),toolbar); combobox=new KComboBox(toolbar); KConfig *config = ktagebuchapp->getConfig(); config->setGroup("Mood Plugin"); if (!config->hasKey("moods")) mPrefs->save(); QStringList strList=QStringList(config->readListEntry("moods")); for (QStringList::Iterator it=strList.begin();it!=strList.end();++it){ combobox->insertItem(i18n(*it)); } combobox->show(); loadEntry(); }
void KFSConfigPage::init() { KConfig *config = kapp->config(); config->setGroup( "fileselector" ); // toolbar QStringList l = config->readListEntry( "toolbar actions", ',' ); if ( l.isEmpty() ) // default toolbar l << "up" << "back" << "forward" << "home" << "short view" << "detailed view" << "bookmarks" << "sync_dir"; // actions from diroperator + two of our own QStringList allActions; allActions << "up" << "back" << "forward" << "home" << "reload" << "mkdir" << "delete" << "short view" << "detailed view" /*<< "view menu" << "show hidden" << "properties"*/ << "bookmarks" << "sync_dir"; QRegExp re("&(?=[^&])"); KAction *ac; QListBox *lb; for ( QStringList::Iterator it=allActions.begin(); it != allActions.end(); ++it ) { lb = l.contains( *it ) ? acSel->selectedListBox() : acSel->availableListBox(); if ( *it == "bookmarks" || *it == "sync_dir" ) ac = fileSelector->actionCollection()->action( (*it).latin1() ); else ac = fileSelector->dirOperator()->actionCollection()->action( (*it).latin1() ); if ( ac ) new ActionLBItem( lb, SmallIcon( ac->icon() ), ac->text().replace( re, "" ), *it ); } // sync int s = fileSelector->autoSyncEvents; cbSyncActive->setChecked( s & KateFileSelector::DocumentChanged ); cbSyncShow->setChecked( s & KateFileSelector::GotVisible ); // histories sbPathHistLength->setValue( fileSelector->cmbPath->maxItems() ); sbFilterHistLength->setValue( fileSelector->filter->maxCount() ); // session cbSesLocation->setChecked( config->readBoolEntry( "restore location", true ) ); cbSesFilter->setChecked( config->readBoolEntry( "restore last filter", true ) ); }
void ToolsConfigWidget::readGroup(const QString &group, QDict<ToolsConfigEntry> *entryDict) { KConfig *config = ToolsFactory::instance()->config(); config->setGroup("External Tools"); QStringList list = config->readListEntry(group); QStringList::ConstIterator it; for (it = list.begin(); it != list.end(); ++it) { config->setGroup(group + " " + (*it)); QString cmdline = config->readPathEntry("CommandLine"); bool isdesktopfile = config->readBoolEntry("DesktopFile"); bool captured = config->readBoolEntry("Captured"); ToolsConfigEntry *entry = new ToolsConfigEntry; entry->menutext = (*it); entry->cmdline = cmdline; entry->isdesktopfile = isdesktopfile; entry->captured = captured; entryDict->insert(*it, entry); } }
bool KCalls::ReadConfig(const char *EntName) { KConfig *config = ((KConnection*) topLevelWidget())->GetConfig(); QStrList List; char *elem; int i = 0; if (config == NULL) return FALSE; config->setGroup(KI_SEC_GLOBAL); config->readListEntry(EntName,List); if ((elem = List.first()) != NULL) do { setColumnWidth(i++,atoi(elem)); } while((elem = List.next()) != NULL); return TRUE; }
void Opts::readSettings(const QString &initHost) { KConfig *config = kapp->config(); config->setGroup("Kpackage"); // kdDebug() << "readSettings: " << initHost << "\n"; hostList = config->readListEntry("Host_list"); if (!initHost.isEmpty() && !hostList.contains(initHost)) { hostList.prepend(initHost); config->writeEntry("Host_list", hostList); } hostList.sort(); DCache = config->readNumEntry("Dir_Cache",1); if (DCache >2) { DCache = 1; } PCache = config->readNumEntry("Package_Cache",0); if (PCache >2) { PCache = 0; } CacheDir = config->readPathEntry("Cache_Directory", QDir::homeDirPath() + "/.kpackage/"); // Backward compatability bool useSSH = config->readNumEntry("Use_SSH",0); privCmd = config->readNumEntry("Priv_Command", -1); if (privCmd == -1) { if (useSSH) { privCmd = SSHcmd; } else { privCmd = SUcmd; } } VerifyFL = config->readNumEntry("Verify_File_List",1); PkgRead = config->readNumEntry("Read_Package_files",0); }
SaverConfig::SaverConfig( TQWidget* parent, const char* name ) : ConfigWidget( parent, name, true ) { connect( m_ok, TQT_SIGNAL(clicked()), TQT_SLOT(apply()) ); connect( m_ok, TQT_SIGNAL(clicked()), TQT_SLOT(accept()) ); connect( m_cancel, TQT_SIGNAL(clicked()), TQT_SLOT(reject()) ); connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_delayLabel, TQT_SLOT(setEnabled(bool)) ); connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_delay, TQT_SLOT(setEnabled(bool)) ); connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_secondsLabel, TQT_SLOT(setEnabled(bool)) ); connect( m_multiple, TQT_SIGNAL(toggled(bool)), m_random, TQT_SLOT(setEnabled(bool)) ); connect( m_files, TQT_SIGNAL(selectionChanged()), TQT_SLOT(select()) ); connect( m_add, TQT_SIGNAL(clicked()), TQT_SLOT(add()) ); connect( m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(remove()) ); connect( m_up, TQT_SIGNAL(clicked()), TQT_SLOT(up()) ); connect( m_down, TQT_SIGNAL(clicked()), TQT_SLOT(down()) ); m_up->setIconSet( SmallIconSet("up") ); m_down->setIconSet( SmallIconSet("down") ); // load config KConfig *cfg = kapp->config(); cfg->setGroup( "Misc" ); bool single = cfg->readBoolEntry( "Single", true ); m_single->setChecked( single ); m_multiple->setChecked( !single ); m_delay->setMinValue( 1 ); m_delay->setMaxValue( 10000 ); m_delay->setValue( cfg->readNumEntry( "Delay", 60 ) ); m_random->setChecked( cfg->readBoolEntry( "Random", false ) ); m_files->insertStringList( cfg->readListEntry( "Files" ) ); // update buttons select(); }
void KonqSidebarHistoryModule::slotCreateItems() { QApplication::setOverrideCursor( KCursor::waitCursor() ); clear(); KonqSidebarHistoryItem *item; KonqHistoryEntry *entry; KonqHistoryList entries( KonqHistoryManager::kself()->entries() ); KonqHistoryIterator it( entries ); m_currentTime = QDateTime::currentDateTime(); // the group item and the item of the serverroot '/' get a fav-icon // if available. All others get the protocol icon. while ( (entry = it.current()) ) { KonqSidebarHistoryGroupItem *group = getGroupItem( entry->url ); item = new KonqSidebarHistoryItem( entry, group, m_topLevelItem ); ++it; } KConfig *kc = KGlobal::config(); KConfigGroupSaver cs( kc, "HistorySettings" ); QStringList openGroups = kc->readListEntry("OpenGroups"); QStringList::Iterator it2 = openGroups.begin(); KonqSidebarHistoryGroupItem *group; while ( it2 != openGroups.end() ) { group = m_dict.find( *it2 ); if ( group ) group->setOpen( true ); ++it2; } QApplication::restoreOverrideCursor(); m_initialized = true; }
bool HTMLSearch::saveFilesList(const QString& _lang) { QStringList dirs; // throw away old files list _files.clear(); // open config file KConfig *config = new KConfig("khelpcenterrc"); config->setGroup("Scope"); // add KDE help dirs if (config->readBoolEntry("KDE", true)) dirs = kapp->dirs()->findDirs("html", _lang + "/"); kdDebug() << "got " << dirs.count() << " dirs\n"; // TODO: Man and Info!! // add local urls QStringList add = config->readListEntry("Paths"); QStringList::Iterator it; for (it = add.begin(); it != add.end(); ++it) { if ( ( *it ).at( ( *it ).length() - 1 ) != '/' ) ( *it ) += '/'; dirs.append(*it); } _filesScanned = 0; for (it = dirs.begin(); it != dirs.end(); ++it) scanDir(*it); delete config; return true; }
void SlickerCardManager::loadCards() { kdDebug(155004) << ("SlickerCardManager::loadCards()\n"); KConfig *config = kapp->config(); config->setGroup("General"); QStringList ids = config->readListEntry("Cards"); for (QStringList::Iterator it = ids.begin(); it != ids.end(); ++it) { kdDebug(155004) << "found card: " << *it << endl; QString groupName = QString("Card_").append(*it); if (!config->hasGroup(groupName)) continue; KConfigGroup group(config,groupName); CardDesk::Card *card = createCard(group.readEntry("AppletDesktopFile"), group.readEntry("AppletConfigFile"), &group); if (!card) continue; card->setCardId(*it); registerCard(card); } }
bool Settings::read_settings(KConfig &cfg_P, bool include_disabled_P, ImportType import_P) { if(actions == NULL) actions = new Action_data_group(NULL, "should never see", "should never see", NULL, Action_data_group::SYSTEM_ROOT, true); if(cfg_P.groupList().count() == 0) // empty return false; cfg_P.setGroup("Main"); // main group if(import_P == ImportNone) // reading main cfg file already_imported = cfg_P.readListEntry("AlreadyImported"); else { QString import_id = cfg_P.readEntry("ImportId"); if(!import_id.isEmpty()) { if(already_imported.contains(import_id)) { if(import_P == ImportSilent || KMessageBox::warningContinueCancel(NULL, i18n("This \"actions\" file has already been imported before. " "Are you sure you want to import it again?")) != KMessageBox::Continue) return true; // import "successful" } else already_imported.append(import_id); } else { if(import_P != ImportSilent && KMessageBox::warningContinueCancel(NULL, i18n("This \"actions\" file has no ImportId field and therefore it cannot be determined " "whether or not it has been imported already. Are you sure you want to import it?")) == KMessageBox::Cancel) return true; } } int version = cfg_P.readNumEntry("Version", -1234576); switch(version) { case 1: read_settings_v1(cfg_P); break; case 2: read_settings_v2(cfg_P, include_disabled_P); break; default: kdWarning(1217) << "Unknown cfg. file version\n"; return false; case -1234576: // no config file if(import_P) // if importing, this is an error return false; break; } if(import_P != ImportNone) return true; // don't read global settings cfg_P.setGroup("Main"); // main group daemon_disabled = cfg_P.readBoolEntry("Disabled", false); cfg_P.setGroup("Gestures"); gestures_disabled_globally = cfg_P.readBoolEntry("Disabled", true); gesture_mouse_button = cfg_P.readNumEntry("MouseButton", 2); gesture_mouse_button = KCLAMP(gesture_mouse_button, 2, 9); gesture_timeout = cfg_P.readNumEntry("Timeout", 300); cfg_P.setGroup("GesturesExclude"); delete gestures_exclude; gestures_exclude = new Windowdef_list(cfg_P); cfg_P.setGroup("Voice"); voice_shortcut = KShortcut(cfg_P.readEntry("Shortcut", "")); return true; }
int main(int argc, char* argv[]) { setuid(getuid()); setgid(getgid()); // drop privileges kimgioRegister(); // add io for additional image formats // deal with shell/command //////////////////////////// int login_shell=0; int welcome=1; char* shell = getenv("SHELL"); char* wname = PACKAGE; if (shell == NULL || *shell == '\0') shell = "/bin/sh"; QString sz = ""; QStrList eargs; eargs.append(shell); setlocale( LC_ALL, "" ); KApplication a(argc, argv, PACKAGE); for (int i = 1; i < argc; i++) { if (!strcmp(argv[i],"-e") && i+1 < argc) // handle command { if (login_shell) fprintf(stderr,"-e excludes -ls.\n"); login_shell = 0; // does not make sense here. eargs.clear(); int j; for (j = 0; j+i+1 < argc; j++) eargs.append( argv[i+j+1] ); break; } if (!strcmp(argv[i],"-vt_sz") && i+1 < argc) sz = argv[++i]; if (!strcmp(argv[i],"-sl") && i+1 < argc) { QString a(argv[++i]); maxHistLines = a.toInt(); } if (!strcmp(argv[i],"-name") && i+1 < argc) wname = argv[++i]; if (!strcmp(argv[i],"-ls") ) login_shell=1; if (!strcmp(argv[i],"-nowelcome")) welcome=0; if (!strcmp(argv[i],"-h")) { usage(); exit(0); } if (!strcmp(argv[i],"-help")) { usage(); exit(0); } if (!strcmp(argv[i],"--help")) { usage(); exit(0); } //FIXME: more: font, menu, scrollbar, schema, session ... } // /////////////////////////////////////////////// putenv("COLORTERM="); //FIXME: for mc, which cannot detect color terminals int c = 0, l = 0; if ( (strcmp("", sz) != 0) ) { char *ls = strchr( sz.data(), 'x' ); if ( ls != NULL ) { *ls='\0'; ls++; c=atoi(sz); l=atoi(ls); } else { fprintf(stderr, "expected -vt_sz <#columns>x<#lines> ie. 80x40\n" ); } } if (a.isRestored()) { KConfig * sessionconfig = a.getSessionConfig(); sessionconfig->setGroup("options"); sessionconfig->readListEntry("konsolearguments", eargs); wname = sessionconfig->readEntry("class",wname).data(); RESTORE( TEDemo(wname,eargs,login_shell) ) }
void servercontroller::do_autoconnect() { static int stime = 0; static int ctime = 0; int loop; kdDebug(5008) << "Doing AUTOCONNECT" << endl; KConfig *conf = kapp->config(); conf->setGroup("AutoConnect"); QStringList servers = conf->readListEntry("Servers"); servers.sort(); QStringList::ConstIterator ser = servers.begin(); loop = 0; for( ; ser != servers.end(); ser++){ if(loop++ == stime){ stime++; QString server = *ser; QString port = "6667"; bool usessl = false; QString pass = QString::null; QRegExp rx("(.+) \\(SSL\\)(.*)"); if(rx.search(server) >= 0){ server = rx.cap(1) + rx.cap(3); usessl = true; } rx.setPattern("(.+) \\(pass: (\\S+)\\)(.*)"); if(rx.search(server) >= 0){ server = rx.cap(1) + rx.cap(3); pass = rx.cap(2); } rx.setPattern("([^: ]+):(\\d+)"); if(rx.search(server) >= 0){ server = rx.cap(1); port = rx.cap(2); } kdDebug(5008) << server << ": Done " << port << " " << usessl << " " << pass << endl; KSircServer kss(server, port, "", pass, usessl); new_ksircprocess(kss); return; } } loop = 0; ser = servers.begin(); for( ; ser != servers.end(); ser++){ QStringList channels = conf->readListEntry(*ser); if(channels.empty() == FALSE){ channels.sort(); QStringList::ConstIterator chan = channels.begin(); for(; chan != channels.end(); chan++){ if(loop++ == ctime){ ctime++; QString channel = *chan; QString key = QString::null; QRegExp crx("(.+) \\(key: (\\S+)\\)"); if(crx.search(channel) >= 0){ channel = crx.cap(1); key = crx.cap(2); } QString server = *ser; QRegExp rx("^([^ :]+)"); if(rx.search(server) >= 0){ server = rx.cap(1); } kdDebug(5008) << server << ": Channed: " << channel << " key: " << key << endl; new_toplevel(KSircChannel(server, channel, key), true); return; } } } } ctime = 0; stime = 0; at->stop(); delete at; }