void Board::readRating(KConfig *config) { QStrList list; QString tmp; if (config->readListEntry("StoneValues", list)) { stoneValue[0] = 0; for(int i=1;i<6;i++) stoneValue[i] = (tmp = list.at(i-1)).toInt(); } if (config->readListEntry("MoveValues", list)) { for(int i=0;i<5;i++) moveValue[i] = (tmp = list.at(i)).toInt(); } if (config->readListEntry("RingValues", list)) { for(int i=0;i<5;i++) ringValue[i] = (tmp = list.at(i)).toInt(); } if (config->readListEntry("RingDiffs", list)) { for(int i=0;i<5;i++) ringDiff[i] = (tmp = list.at(i)).toInt(); } setFieldValues(); }
int readListConf ( KConfig *conf, QString key, QStrList &list ) { if( !conf->hasKey( key ) ) { // debug("readListConf:: key does not exist"); return 0; } QString str_list, value; str_list = conf->readEntry(key); if(str_list.isEmpty()) { // debug("readListConf:: list is empty"); return 0; } list.clear(); int i; int len = str_list.length(); for( i = 0; i < len; i++ ) { if( str_list[i] != ',' && str_list[i] != '\\' ) { value += str_list[i]; continue; } if( str_list[i] == '\\' ) { i++; value += str_list[i]; continue; } list.append(value); value.truncate(0); } list.append(value); }
void writeListConf ( KConfig *conf, QString key, QStrList &list ) { if( list.isEmpty() ) { conf->writeEntry(key, ""); return; } QString str_list; QString value; int i; for( value = list.first(); value != ""; value = list.next() ) { for( i = 0; i < (int) value.length(); i++ ) { switch( value[i] ) { case ',': str_list += '\\'; break; case '\\': str_list += '\\'; break; //defaults: //; }; str_list += value[i]; } str_list += ','; } if( str_list.right(1) == "," ) str_list.truncate(str_list.length()-1); conf->writeEntry(key, str_list); }
KIconLoader::KIconLoader( KConfig *conf, const QString &app_name, const QString &var_name ){ QStrList list; config = conf; config->setGroup(app_name); config->readListEntry( var_name, list, ':' ); for (const char *it=list.first(); it; it = list.next()) addPath(it); initPath(); name_list.setAutoDelete(TRUE); pixmap_dirs.setAutoDelete(TRUE); pixmap_list.setAutoDelete(TRUE); /* for(char* c = pixmap_dirs.first(); c ; c = pixmap_dirs.next()){ printf("in path:%s\n",pixmap_dirs.current()); } */ }
void KFMClient::slotMove( const char *_src_urls, const char *_dest_url ) { QString s = _src_urls; s.detach(); QStrList urlList; QString dest = _dest_url; if ( dest == "trash:/" ) dest = "file:" + KFMPaths::TrashPath(); int i; while ( ( i = s.find( "\n" ) ) != -1 ) { QString t = s.left( i ); urlList.append( t.data() ); s = s.mid( i + 1, s.length() ); } urlList.append( s.data() ); KIOJob *job = new KIOJob(); connect( job, SIGNAL( finished( int ) ), this, SLOT( finished( int ) ) ); if ( urlList.count() == 1 ) job->move( urlList.first(), dest.data() ); else job->move( urlList, dest.data() ); }
void KFMServer::slotCopyClients( const char *_src_urls, const char *_dest_url ) { QString s = _src_urls; s.detach(); QStrList urlList; QString dest = _dest_url; if ( dest == "trash:/" ) dest = "file:" + KFMPaths::TrashPath(); int i; while ( ( i = s.find( "\n" ) ) != -1 ) { QString t = s.left( i ); urlList.append( t.data() ); s = s.mid( i + 1, s.length() ); } urlList.append( s.data() ); KIOJob *job = new KIOJob(); if ( urlList.count() == 1 ) job->copy( urlList.first(), dest.data() ); else job->copy( urlList, dest.data() ); }
/*! Decodes URLs from \a e, placing the result in \a l (which is first cleared). Returns TRUE if the event contained a valid list of URLs. */ bool QUrlDrag::decode( QDropEvent* e, QStrList& l ) { QByteArray payload = e->data( "url/url" ); if ( payload.size() ) { e->accept(); l.clear(); l.setAutoDelete(TRUE); uint c=0; char* d = payload.data(); while (c < payload.size()) { uint f = c; while (c < payload.size() && d[c]) c++; if ( c < payload.size() ) { l.append( d+f ); c++; } else { QString s(d+f,c-f+1); l.append( s ); } } return TRUE; } return FALSE; }
/*! Decodes URIs from \a e, placing the result in \a l (which is first cleared). Returns TRUE if the event contained a valid list of URIs. */ bool QUriDrag::decode( const QMimeSource* e, QStrList& l ) { QByteArray payload = e->encodedData( "text/uri-list" ); if ( payload.size() ) { l.clear(); l.setAutoDelete(TRUE); uint c=0; char* d = payload.data(); while (c < payload.size() && d[c]) { uint f = c; // Find line end while (c < payload.size() && d[c] && d[c]!='\r' && d[c] != '\n') c++; QCString s(d+f,c-f+1); if ( s[0] != '#' ) // non-comment? l.append( s ); // Skip junk while (c < payload.size() && d[c] && (d[c]=='\n' || d[c]=='\r')) c++; } return TRUE; } return FALSE; }
void SlotTester::allTests() { QStrList allSlots = metaObject()->slotNames(); if ( allSlots.contains("setUp()") > 0 ) invokeMember("setUp()"); for ( char *sl = allSlots.first(); sl; sl = allSlots.next() ) { QString str = sl; if ( str.startsWith("test") ) { m_results = results(sl); m_results->clear(); cout << "KUnitTest_Debug_BeginSlot[" << sl << "]" << endl; invokeMember(str); cout << "KUnitTest_Debug_EndSlot[" << sl << "]" << endl; } } if ( allSlots.contains("tearDown()") > 0 ) invokeMember("tearDown()"); m_total->clear(); }
ac::ac(const QString &changes, QWidget *parent, const char *name, const QStringList &) :AcDialog(parent, name) { borderFrame->hide(); setGeometry( x(), y(), 500, 30); borderFrame->setGeometry( 0, 0, 500, 400); konsoleFrame->setGeometry( 0, 0, 500, 400); appdir = "/usr/share/apt-get-konsole/"; loadKonsole(); konsoleFrame->installEventFilter( this ); changes2 = changes; QStrList run; run.append( appdir+"sh/applyChanges" ); run.append( changes ); // run command terminal()->startProgram( appdir+"sh/applyChanges", run ); j=0; firstdownload = TRUE; connect( konsole, SIGNAL( receivedData( const QString& ) ), SLOT( shellOutput( const QString&) ) ); connect( konsole, SIGNAL( destroyed() ), SLOT( close() ) ); }
void ossimQtQuadProjectionController::buildDatumMenu() const { // Build the datum menu. QStrList datumList; std::vector<ossimString> tempOssimDatumList = ossimDatumFactory::instance()->getList(); std::vector<ossimString>::iterator listIter = tempOssimDatumList.begin(); while(listIter != tempOssimDatumList.end()) { const ossimDatum* datum = ossimDatumFactory::instance()-> create(*listIter); if(datum) { datumList.append((datum->code() + ": " + datum->name()).c_str()); } ++listIter; } theDialog->theDatumComboBox->clear(); theDialog->theDatumComboBox->insertStrList(datumList); // Set to WGE for default (WGS-84). const int COUNT = theDialog->theDatumComboBox->count(); for (int i = 0; i < COUNT; ++i) { ossimString name = theDialog->theDatumComboBox->text(i).ascii(); if (name.contains("WGE")) { theDialog->theDatumComboBox->setCurrentItem(i); break; } } }
void RubySupportPart::projectOpened() { kdDebug() << "projectOpened()" << endl; QStrList l; l.append( shell().latin1() ) ; m_shellWidget->setShell( shell().latin1(), l ); m_shellWidget->activate(); m_shellWidget->setAutoReactivateOnClose( true ); connect( project(), SIGNAL(addedFilesToProject(const QStringList &)), this, SLOT(addedFilesToProject(const QStringList &)) ); connect( project(), SIGNAL(removedFilesFromProject(const QStringList &)), this, SLOT(removedFilesFromProject(const QStringList &)) ); QFileInfo program(mainProgram()); // If it's a Rails project, create the project files if they're missing if (mainProgram().endsWith("script/server")) { QString cmd; QFileInfo server(project()->projectDirectory() + "/script/server"); if (! server.exists()) { cmd += "rails " + project()->projectDirectory(); if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend")) appFrontend->startAppCommand(project()->projectDirectory(), cmd, false); } } // We want to parse only after all components have been // properly initialized QTimer::singleShot(0, this, SLOT(initialParse())); }
void KAMenu::slotHostlistChanged() { /* die Liste der erreichbaren Archiehosts hat sich * veraendert. neu einlesen */ // KConfig *config = KApplication::getKApplication()->getConfig(); QStrList archiehostlist; // int archiehostlistnumber = KConfigGroupSaver saveGroup( config, "HostConfig" ); config->readListEntry( "Hosts", archiehostlist ); // QString currenthost = config->readEntry( "CurrentHost", "archie.sura.net" ); QString defaulthost = "archie.sura.net" ; if ( archiehostlist.isEmpty() ) { archiehostlist.append( defaulthost ); // currentHostId = 0; } host->clear(); char *tmpStr; int i = 0; for (tmpStr=archiehostlist.first(); tmpStr; tmpStr=archiehostlist.next()) { host->insertItem( tmpStr, i, i); i++; } slotConfigChanged(); emit sigArchieHost(host->text(host_id)); }
QStrList objFinder::allObjects(){ /*fold00*/ QStrList allNames; QDictIterator<QObject> it(*objList); while(it.current()){ QObjectList *qobl = it.current()->queryList(); // Matches everything QObjectListIt itql( *qobl ); while(itql.current()){ QString name; name = itql.current()->className(); name += "::"; name += itql.current()->name("unnamed"); allNames.append(name); ++itql; } delete qobl; ++it; } QWidgetList *all = QApplication::allWidgets(); QWidgetListIt itW(*all); while(itW.current()){ QString name; name = itW.current()->className(); name += "::"; name += itW.current()->name("unnamed"); allNames.append(name); ++itW; } delete all; return allNames; }
void CDDBSetup::getData(QStrList& _serverlist, QStrList& _submitlist, QString& _basedir, QString& _submitaddress, QString& _current_server, bool& remote_enabled, bool& http_proxy_enabled, QString &http_proxy_host, int &http_proxy_port) { uint i; _serverlist.clear(); _submitlist.clear(); for(i = 0; i < server_listbox->count();i++){ _serverlist.append(server_listbox->text(i)); } for(i = 0; i < submission_listbox->count(); i++){ _submitlist.append(submission_listbox->text(i)); } _basedir = basedirstring.copy(); _submitaddress = submitaddressstring.copy(); _current_server = current_server_string.copy(); remote_enabled = remote_cddb_cb->isChecked(); http_proxy_enabled = cddb_http_cb->isChecked(); http_proxy_host = proxy_host_ef->text(); http_proxy_port = atoi(proxy_port_ef->text()); }
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 KFMServer::slotExec( const char* _url, const char * _documents ) { KURL u( _url ); if ( u.isMalformed() ) { QString msg; ksprintf(&msg, i18n( "The URL\n%s\nis malformed" ), _url); QMessageBox::warning( (QWidget*)0, i18n( "KFM Error" ), msg ); return; } if ( _documents == 0L && _url != 0L ) { KFMExec *e = new KFMExec; e->openURL( _url ); return; } QString s( _documents ); QStrList urlList; int i; while ( ( i = s.find( "\n" ) ) != -1 ) { QString t = s.left( i ); urlList.append( t.data() ); s = s.mid( i + 1, s.length() ); } urlList.append( s.data() ); KMimeType *typ = KMimeType::getMagicMimeType( _url ); typ->runAsApplication( _url, &urlList ); }
void QSPixmapClass::save( QSEnv *env ) { if ( env->numArgs() < 1 || env->numArgs() > 2 ) { env->throwError( QString::fromLatin1( "Pixmap.save() called with %1 arguments. 1 or 2 argument expected." ). arg( env->numArgs() ) ); return; } QSObject t = env->thisValue(); QSPixmapClass *pac = (QSPixmapClass*)t.objectType(); QPixmap *pix = pac->pixmap( &t ); if ( !env->arg( 0 ).isString() ) { env->throwError( QString::fromLatin1( "Pixmap.save() called with an argument of type %1. " "Type String is expeced" ). arg( env->arg( 0 ).typeName() ) ); return; } QString format = QFileInfo( env->arg( 0 ).toString() ).extension().upper(); QStrList l = QImageIO::outputFormats(); if ( l.find( format.latin1() ) == -1 ) format = QString::fromLatin1("PNG"); if ( env->numArgs() == 2 ) { if ( !env->arg( 1 ).isString() ) { env->throwError( QString::fromLatin1( "Pixmap.save() called with an argument of type %1. " "as second argument. Type String is expeced" ). arg( env->arg( 1 ).typeName() ) ); return; } format = env->arg( 1 ).toString(); } pix->save( env->arg( 0 ).toString(), format.latin1() ); }
bool KSrvResolverWorker::preprocess() { // check if the resolver flags mention SRV-based lookup if ((flags() & (KResolver::NoSrv | KResolver::UseSrv)) != KResolver::UseSrv) return false; QString node = nodeName(); if (node.find('%') != -1) node.truncate(node.find('%')); if (node.isEmpty() || node == QString::fromLatin1("*") || node == QString::fromLatin1("localhost")) return false; // empty == localhost encodedName = KResolver::domainToAscii(node); if (encodedName.isNull()) return false; // we only work with Internet-based families if ((familyMask() & KResolver::InternetFamily) == 0) return false; // SRV-based resolution only works if the service isn't numeric bool ok; serviceName().toUInt(&ok); if (ok) return false; // it is numeric // check the protocol for something we know QCString protoname; int sockettype = socketType(); if (!protocolName().isEmpty()) protoname = protocolName(); else if (protocol() != 0) { QStrList names = KResolver::protocolName(protocol()); names.setAutoDelete(true); if (names.isEmpty()) return false; protoname = "_"; protoname += names.at(0); } else if (sockettype == SOCK_STREAM || sockettype == 0) protoname = "_tcp"; else if (sockettype == SOCK_DGRAM) protoname = "_udp"; else return false; // unknown protocol and socket type encodedName.prepend("."); encodedName.prepend(protoname); encodedName.prepend("."); encodedName.prepend(serviceName().latin1()); encodedName.prepend("_"); // looks like something we could process return true; }
bool cddb_playlist_decode(QStrList& list, QString& str){ bool isok = true; int pos1, pos2; pos1 = 0; pos2 = 0; list.clear(); while((pos2 = str.find(",",pos1,true)) != -1){ if(pos2 > pos1){ list.append(str.mid(pos1,pos2 - pos1)); } pos1 = pos2 + 1; } if(pos1 <(int) str.length()) list.append(str.mid(pos1,str.length())); QString check; bool ok1; int num; for(uint i = 0; i < list.count(); i++){ check = list.at(i); check = check.stripWhiteSpace(); if(check.isEmpty()){ list.remove(i); i--; continue; } if(check == QString (",")){ list.remove(i); i--; continue; } num = check.toInt(&ok1); if(!ok1 || num < 1){ list.remove(i); i--; isok = false; continue; } list.remove(i); list.insert(i, check); } /* for(uint i = 0; i < list.count(); i++){ printf("playlist %d=%s\n",i,list.at(i)); }*/ return isok; }
/*! Sets the URIs to be the local-file URIs equivalent to \a fnames. \sa localFileToUri(), setUris() */ void QUriDrag::setFilenames( QStringList fnames ) { QStrList uris; for (QStringList::Iterator i = fnames.begin(); i != fnames.end(); ++i ) uris.append(localFileToUri(*i)); setUris(uris); }
void PPPdArguments::closebutton() { QStrList arglist; for(uint i=0; i < arguments->count(); i++) arglist.append(arguments->text(i)); gpppdata.setpppdArgument(arglist); done(0); }
/*! Sets the URIs to be the Unicode URIs (only useful for displaying to humans) \a uuris. \sa localFileToUri(), setUris() */ void QUriDrag::setUnicodeUris( QStringList uuris ) { QStrList uris; for (QStringList::Iterator i = uuris.begin(); i != uuris.end(); ++i ) uris.append(unicodeUriToUri(*i)); setUris(uris); }
void KConfigBase::writeEntry(const char *pKey, const QPoint &rPoint, bool bPersistent, bool bGlobal, bool bNLS) { QStrList list; QCString tempstr; list.insert(0, tempstr.setNum(rPoint.x())); list.insert(1, tempstr.setNum(rPoint.y())); writeEntry(pKey, list, ',', bPersistent, bGlobal, bNLS); }
void KConfigBase::writeEntry(const char *pKey, const QSize &rSize, bool bPersistent, bool bGlobal, bool bNLS) { QStrList list; QCString tempstr; list.insert(0, tempstr.setNum(rSize.width())); list.insert(1, tempstr.setNum(rSize.height())); writeEntry(pKey, list, ',', bPersistent, bGlobal, bNLS); }
QStrList Dispatcher::instanceNames() const { kdDebug( 701 ) << k_funcinfo << endl; QStrList names; for( QMap<QCString, InstanceInfo>::ConstIterator it = m_instanceInfo.begin(); it != m_instanceInfo.end(); ++it ) if( ( *it ).count > 0 ) names.append( it.key() ); return names; }
void KMix::onDrop( KDNDDropZone* _zone ) { QStrList strlist; KURL *url; strlist = _zone->getURLList(); url = new KURL( strlist.first() ); delete url; }
static void clearAlignList( QStrList &l ) { if ( l.count() == 1 ) return; if ( l.find( "AlignAuto" ) != -1 ) l.remove( "AlignAuto" ); if ( l.find( "WordBreak" ) != -1 ) l.remove( "WordBreak" ); }
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(); }
QStrList *MarkListTable::markList() { QStrList *l = new QStrList; for ( int i=0 ; i < (signed) items.count(); i++ ) if ( ( items.at( i ) )->mark() ) l->append( items.at( i )->text() ); return l; }