bool HomeImpl::listHomes(QValueList<KIO::UDSEntry> &list) { kdDebug() << "HomeImpl::listHomes" << endl; KUser current_user; QValueList<KUserGroup> groups = current_user.groups(); QValueList<int> uid_list; QValueList<KUserGroup>::iterator groups_it = groups.begin(); QValueList<KUserGroup>::iterator groups_end = groups.end(); for(; groups_it!=groups_end; ++groups_it) { QValueList<KUser> users = (*groups_it).users(); QValueList<KUser>::iterator it = users.begin(); QValueList<KUser>::iterator users_end = users.end(); for(; it!=users_end; ++it) { if ((*it).uid()>=MINIMUM_UID && !uid_list.contains( (*it).uid() ) ) { uid_list.append( (*it).uid() ); KIO::UDSEntry entry; createHomeEntry(entry, *it); list.append(entry); } } } return true; }
void PMLatheEdit::slotAddPointBelow( ) { int index = m_pPoints->currentRow( ); if( index >= 0 ) { QValueList<PMVector> points = m_pPoints->vectors( ); QValueListIterator<PMVector> it = points.at( index ); if( it != points.end( ) ) { QValueListIterator<PMVector> it2 = it; it2++; PMVector v; if( it2 == points.end( ) ) v = *it; else v = ( *it + *it2 ) / 2; points.insert( it2, v ); m_pPoints->setVectors( points, true ); m_pPoints->setCurrentCell( index + 1, m_pPoints->currentColumn( ) ); updatePointButtons( ); emit dataChanged( ); emit sizeChanged( ); } } }
void HomeDirNotify::init() { if(mInited) return; mInited = true; KUser current_user; QValueList< KUserGroup > groups = current_user.groups(); QValueList< int > uid_list; QValueList< KUserGroup >::iterator groups_it = groups.begin(); QValueList< KUserGroup >::iterator groups_end = groups.end(); for(; groups_it != groups_end; ++groups_it) { QValueList< KUser > users = (*groups_it).users(); QValueList< KUser >::iterator it = users.begin(); QValueList< KUser >::iterator users_end = users.end(); for(; it != users_end; ++it) { if((*it).uid() >= MINIMUM_UID && !uid_list.contains((*it).uid())) { uid_list.append((*it).uid()); QString name = (*it).loginName(); KURL url; url.setPath((*it).homeDir()); m_homeFoldersMap[name] = url; } } } }
ScimSetupWindow::ScimSetupWindow(scim::SocketServerThread *parent, const char */*name*/, KConfigSkeleton */*config*/) : KCMultiDialog(KDialogBase::TreeList, i18n("Configure skim"), 0), d(new ScimSetupWindowPrivate) { m_mc = SkimPluginManager::self(); setIcon(KGlobal::iconLoader()->loadIcon("configure", KIcon::NoGroup)); d->inputServer = parent; d->scim_backend_need_update = false; setShowIconsInTreeList( true ); connect( this, SIGNAL( configCommitted( const QCString & ) ), KSettings::Dispatcher::self(), SLOT( reparseConfiguration( const QCString & ) ) ); connect( this, SIGNAL( configCommitted( const QCString & ) ), SLOT(slotConfigurationChangedFor( const QCString & ))); connect( m_mc, SIGNAL(allPluginsLoaded()), this, SLOT(load())); //we cache all the available kcms and their hierarchy, so that we do not //need to reload them everytime load() is called QValueList<SkimPluginInfo *> skimplugins = SkimPluginInfo::fromServices( KTrader::self()->query( "Skim/SetupDir", "[X-KDE-PluginInfo-Category] == 'Root'" )); QValueList<SkimPluginInfo *>::ConstIterator pit; ScimSetupWindowPrivate::SetupDirInfo curDir; for ( pit = skimplugins.begin(); pit != skimplugins.end(); ++pit ) { curDir.sortedMods.clear(); curDir.path.clear(); QValueList< KService::Ptr > services = KTrader::self()->query( "Skim/KCModule", "[X-KDE-PluginInfo-DisplayParent] == '" + (*pit)->pluginName() + "'" ); std::multimap<int, int> sortedMods; //map weight to index in mods /*if( services.size() > 1)*/ { curDir.path << (*pit)->name(); curDir.iconfile = (*pit)->icon(); //sort the kcm according to their weight. 0 will be the first for( QValueList<KService::Ptr>::ConstIterator it = services.begin(); it != services.end(); ++it ) { KCModuleInfo mod(*it); d->mods.push_back(mod); curDir.sortedMods.insert(std::pair<int, int> (mod.weight(), d->mods.size()-1)); } QVariant v = ( *pit )->weight(); int weight = v.isValid () ? v.toInt() : 1000; //sort the dir according to their weight. 0 will be the first d->dirReposition.insert(std::pair<int, ScimSetupWindowPrivate::SetupDirInfo> (weight, curDir)); } } load(); if(ScimKdeSettings::self()->config()->hasGroup(SetupWindowGroup)) { ScimKdeSettings::self()->config()->setGroup(SetupWindowGroup); if( ScimKdeSettings::self()->config()->hasKey(SetupWindowSize)) resize(ScimKdeSettings::self()->config()->readSizeEntry(SetupWindowSize)); } }
void CorrelationView::askForCorrelograms(){ //If the widget is not about to be deleted, request the data. if(!goingToDie){ dataReady = false; //Compute the pairs for all the clusters currently shown. const QValueList<int>& shownClusters = view.clusters(); QValueList<int> clusters; QValueList<int>::const_iterator clustersIterator; for(clustersIterator = shownClusters.begin(); clustersIterator != shownClusters.end(); ++clustersIterator) clusters.append(*clustersIterator); qHeapSort(clusters); pairs.clear(); QValueList<Pair>* clusterPairs = new QValueList<Pair>(); QValueList<int>::iterator iterator; int i = 0; for(iterator = clusters.begin(); iterator != clusters.end(); ++iterator){ QValueList<int>::iterator iterator2; for(iterator2 = clusters.at(i); iterator2 != clusters.end(); ++iterator2){ //Create pairs as (*iterator,*iterator2) where *iterator <= *iterator2 pairs.append(Pair(*iterator,*iterator2)); clusterPairs->append(Pair(*iterator,*iterator2)); } ++i; } //Create a thread to get the correlation data for that cluster. CorrelationThread* correlationThread = getCorrelations(clusterPairs,clusters); threadsToBeKill.append(correlationThread); } }
void VariableDialog::okClicked() { QValueList<MetaDataBase::Variable> lst; QListViewItemIterator it( varView ); while ( it.current() != 0 ) { MetaDataBase::Variable v; v.varName = it.current()->text( 0 ).simplifyWhiteSpace(); if ( v.varName[ (int)v.varName.length() - 1 ] != ';' ) v.varName += ";"; v.varAccess = it.current()->text( 1 ); lst << v; ++it; } if ( !lst.isEmpty() ) { QValueList<MetaDataBase::Variable> invalidLst; QValueList<MetaDataBase::Variable>::Iterator it1 = lst.begin(); QValueList<MetaDataBase::Variable>::Iterator it2; for ( ; it1 != lst.end(); ++it1 ) { it2 = it1; ++it2; for ( ; it2 != lst.end(); ++it2 ) { if ( MetaDataBase::extractVariableName( (*it1).varName ) == MetaDataBase::extractVariableName( (*it2).varName ) ) { invalidLst << (*it1); break; } } } if ( !invalidLst.isEmpty() ) { if ( QMessageBox::information( this, tr( "Edit Variables" ), tr( "One variable has been declared twice.\n" "Remove this variable?" ), tr( "&Yes" ), tr( "&No" ) ) == 0 ) { for ( it2 = invalidLst.begin(); it2 != invalidLst.end(); ++it2 ) { it = varView->firstChild(); while ( it.current() != 0 ) { if ( MetaDataBase::extractVariableName( (*it)->text( 0 ).simplifyWhiteSpace() ) == MetaDataBase::extractVariableName( (*it2).varName ) ) { delete (*it); break; } ++it; } } } formWindow->mainWindow()->objectHierarchy()->updateFormDefinitionView(); return; } } Command *cmd = new SetVariablesCommand( "Edit variables", formWindow, lst ); formWindow->commandHistory()->addCommand( cmd ); cmd->execute(); accept(); }
void KNCollectionView::addPendingFolders() { QValueList<KNFolder *> folders = knGlobals.folderManager()->folders(); for(QValueList<KNFolder *>::Iterator it = folders.begin(); it != folders.end(); ++it) if(!(*it)->listItem()) addFolder((*it)); // now open the folders if they were open in the last session for(QValueList<KNFolder *>::Iterator it = folders.begin(); it != folders.end(); ++it) if((*it)->listItem()) (*it)->listItem()->setOpen((*it)->wasOpen()); }
QStringList KUser::groupNames() const { QStringList result; QValueList<KUserGroup> allGroups = KUserGroup::allGroups(); QValueList<KUserGroup>::const_iterator it; for ( it = allGroups.begin(); it != allGroups.end(); ++it ) { QValueList<KUser> users = (*it).users(); if ( users.find( *this ) != users.end()) { result.append((*it).name()); } } return result; }
void WebQueryPubMed::query( const QString& searchTerm, int numberOfResults ) { WebQuery::query( searchTerm, numberOfResults ); emit setTotalSteps( 2 ); QString term = searchTerm; KURL url = KURL( QString( "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pubmed&term=%1&retmax=%2&tool=KBibTeX&[email protected]" ).arg( term.replace( "%", "%25" ).replace( " ", "+" ).replace( "?", "%3F" ).replace( "&", "%26" ) ).arg( numberOfResults ) ); QString tmpFile; if ( KIO::NetAccess::download( url, tmpFile, m_parent ) && !m_aborted ) { QFile inputFile( tmpFile ); QValueList<int> intList; QXmlInputSource inputSource( &inputFile ); QXmlSimpleReader reader; WebQueryPubMedStructureParserQuery handler( &intList ); reader.setContentHandler( &handler ); reader.parse( &inputSource ); inputFile.close(); KIO::NetAccess::removeTempFile( tmpFile ); emit setProgress( 1 ); QString ids; QValueList<int>::iterator it = intList.begin(); if ( it != intList.end() ) { ids.append( QString::number( *it ) ); ++it; for ( ; it != intList.end(); ++it ) { ids.append( "," ); ids.append( QString::number( *it ) ); } } url = KURL( QString( "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&retmode=xml&id=%1&tool=KBibTeX&[email protected]" ).arg( ids ) ); if ( KIO::NetAccess::download( url, tmpFile, m_parent ) && !m_aborted ) { QFile inputFile( tmpFile ); QDomDocument doc( "efetch'ed" ); doc.setContent( &inputFile ); QDomElement docElem = doc.documentElement(); emit setProgress( 2 ); WebQueryPubMedResultParser resultParser; connect( &resultParser, SIGNAL( foundEntry( BibTeX::Entry* ) ), this, SIGNAL( foundEntry( BibTeX::Entry* ) ) ); resultParser.parse( doc.documentElement() ); inputFile.close(); KIO::NetAccess::removeTempFile( tmpFile ); emit endSearch( false ); }
void CalendarDiffAlgo::diffList( const QString &id, const QValueList<L> &left, const QValueList<L> &right ) { for ( uint i = 0; i < left.count(); ++i ) { if ( right.find( left[ i ] ) == right.end() ) additionalLeftField( id, toString( left[ i ] ) ); } for ( uint i = 0; i < right.count(); ++i ) { if ( left.find( right[ i ] ) == left.end() ) additionalRightField( id, toString( right[ i ] ) ); } }
bool OKeyFilterPrivate::filter( int unicode, int keycode, int modifiers, bool isPress, bool autoRepeat ) { QValueList<QWSServer::KeyboardFilter*>::Iterator iter; for (iter=preFilterList.begin();iter!=preFilterList.end();++iter) { if ((*iter)->filter(unicode,keycode,modifiers,isPress,autoRepeat)) { return true; } } for (iter=filterList.begin();iter!=filterList.end();++iter) { if ((*iter)->filter(unicode,keycode,modifiers,isPress,autoRepeat)) { return true; } } return false; }
/*! Checks whether the slot specified by (tryFrom, tryTo) is available for the participant specified with attendee. If yes, return true. If not, return false and change (tryFrom, tryTo) to contain the next possible slot for this participant (not necessarily a slot that is available for all participants). */ bool KOEditorFreeBusy::tryDate( FreeBusyItem *attendee, QDateTime &tryFrom, QDateTime &tryTo ) { // If we don't have any free/busy information, assume the // participant is free. Otherwise a participant without available // information would block the whole allocation. KCal::FreeBusy *fb = attendee->freeBusy(); if( !fb ) return true; QValueList<KCal::Period> busyPeriods = fb->busyPeriods(); for( QValueList<KCal::Period>::Iterator it = busyPeriods.begin(); it != busyPeriods.end(); ++it ) { if( (*it).end() <= tryFrom || // busy period ends before try period (*it).start() >= tryTo ) // busy period starts after try period continue; else { // the current busy period blocks the try period, try // after the end of the current busy period int secsDuration = tryFrom.secsTo( tryTo ); tryFrom = (*it).end(); tryTo = tryFrom.addSecs( secsDuration ); // try again with the new try period tryDate( attendee, tryFrom, tryTo ); // we had to change the date at least once return false; } } return true; }
void MainWindow::slotPreferences() { static SettingsDialogWrapper *dlg = 0; if ( !dlg ) { // do not show settings of components running standalone QValueList<KPluginInfo*> filteredPlugins = mPluginInfos; PluginList::ConstIterator it; for ( it = mPlugins.begin(); it != mPlugins.end(); ++it ) if ( (*it)->isRunningStandalone() ) { QValueList<KPluginInfo*>::ConstIterator infoIt; for ( infoIt = filteredPlugins.begin(); infoIt != filteredPlugins.end(); ++infoIt ) { if ( (*infoIt)->pluginName() == (*it)->identifier() ) { filteredPlugins.remove( *infoIt ); break; } } } dlg = new SettingsDialogWrapper( KSettings::Dialog::Configurable, this ); dlg->addPluginInfos( filteredPlugins ); connect( dlg, SIGNAL( pluginSelectionChanged() ), SLOT( pluginsChanged() ) ); } dlg->show(); dlg->fixButtonLabel( this ); }
void Plugin::countScalarsVectorsAndStrings(const QValueList<Plugin::Data::IOValue>& table, unsigned& scalars, unsigned& vectors, unsigned& strings, unsigned& numberOfPids) { scalars = 0; vectors = 0; strings = 0; numberOfPids = 0; for (QValueList<Plugin::Data::IOValue>::ConstIterator it = table.begin(); it != table.end(); ++it) { switch ((*it)._type) { case Plugin::Data::IOValue::StringType: ++strings; break; case Plugin::Data::IOValue::PidType: ++numberOfPids; case Plugin::Data::IOValue::FloatType: ++scalars; break; case Plugin::Data::IOValue::TableType: if ((*it)._subType == Plugin::Data::IOValue::FloatSubType || (*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) { ++vectors; } break; default: break; } } }
void KNotesApp::slotConfigureAccels() { KNotesKeyDialog keys( m_globalAccel, this ); QDictIterator<KNote> notes( m_noteList ); if ( !m_noteList.isEmpty() ) keys.insert( (*notes)->actionCollection() ); keys.configure(); m_globalAccel->writeSettings(); updateGlobalAccels(); // update GUI doc for new notes m_noteGUI.setContent( KXMLGUIFactory::readConfigFile( instance()->instanceName() + "ui.rc", instance() ) ); if ( m_noteList.isEmpty() ) return; notes.toFirst(); QValueList<KAction *> list = (*notes)->actionCollection()->actions(); for ( QValueList<KAction *>::iterator it = list.begin(); it != list.end(); ++it ) { notes.toFirst(); for ( ++notes; *notes; ++notes ) { KAction *toChange = (*notes)->actionCollection()->action( (*it)->name() ); if ( toChange->shortcut() != (*it)->shortcut() ) toChange->setShortcut( (*it)->shortcut() ); } } }
void CompMgrClient::loadCompositeSettingsInternal() { m_enableComposite = ScimKdeSettings::enable_Composite(); disconnect(SkimPluginManager::self(), SIGNAL(allPluginsLoaded()), this, SLOT(updateCompositeSettings())); if(m_enableComposite) { if(!m_createdAtoms || m_useKompmgr != ScimKdeSettings::use_Kompmgr()) { m_useKompmgr = ScimKdeSettings::use_Kompmgr(); create_X11_atoms(); } connect(SkimPluginManager::self(), SIGNAL(allPluginsLoaded()), this, SLOT(updateCompositeSettings())); } QStringList availableWindows; QValueList<QObject *> list = SkimPluginManager::self()->specialProperyObjects(); QValueList<QObject *>::iterator it; QWidget * w; for ( it = list.begin(); it != list.end(); ++it ) { w = (*it)->isWidgetType()?static_cast<QWidget *>(*it) : 0; if(w) availableWindows << w->name(); } m_compSetting.clear(); for(uint i=0; i < availableWindows.size(); i++) { fillWidgetSetting(availableWindows[i]); } }
void CompMgrClient::updateCompositeSettings(QString widgetname) { if(m_enableComposite) { QValueList<QObject *> list = SkimPluginManager::self()->specialProperyObjects(); //TODO: add a property name QValueList<QObject *>::iterator it; QWidget * w; for ( it = list.begin(); it != list.end(); ++it ) { w = (*it)->isWidgetType()?static_cast<QWidget *>(*it) : 0; if(w) { if( widgetname == QString::null || w->name() == widgetname) { fillWidgetSetting(QString(w->name()), false); if(m_compSetting[w->name()].translucencyEnabled) { setOpacity(w, m_compSetting[w->name()].translucency); kdDebug() << "Updating transparent window '" << w->name() << "'\n"; } else setOpacity(w, 100); } } } } }
static QCString dispositionField( DispositionType d, ActionMode a, SendingMode s, const QValueList<DispositionModifier> & m ) { // mandatory parts: Disposition: foo/baz; bar QCString result = "Disposition: "; result += stringFor( a ); result += "/"; result += stringFor( s ); result += "; "; result += stringFor( d ); // optional parts: Disposition: foo/baz; bar/mod1,mod2,mod3 bool first = true; for ( QValueList<DispositionModifier>::const_iterator mt = m.begin() ; mt != m.end() ; ++mt ) { if ( first ) { result += "/"; first = false; } else { result += ","; } result += stringFor( *mt ); } return result + "\n"; }
QValueList<Problem> cloneProblemList( const QValueList<Problem>& list ) { QValueList<Problem> ret; for( QValueList<Problem>::const_iterator it = list.begin(); it != list.end(); ++it ) { ret << Problem( *it, true ); } return ret; }
void CodeManager::substitute() { Q_ASSERT(templateIsSubstitutable()); QString substTxt("/*!POA!*/\n"); QValueList<PinModel*> pins = model_->pins(); for (QValueListIterator<PinModel *> it = pins.begin(); it != pins.end(); ++it) { PinModel *pin = *it; substTxt.append(QString(" np_pio *%1 = (np_pio*) 0x%2;\n") .arg(pin->name()) .arg(pin->address(), 0, 16)); } QString source = sourceCode(); // Note: f*****g QRegExp doesn't work over newlines, so // we've to double-match... - so QRegExp is useless indeed :(( int firstIndex = source.find("/*!POA!*/"); int lastIndex = source.find("/*!AOP!*/"); Q_ASSERT(firstIndex < lastIndex); source.replace(firstIndex, lastIndex - firstIndex, substTxt); model_->setSource(source); saveSource(); }
void PanelRemoveButtonMenu::slotAboutToShow() { clear(); containers.clear(); addToContainers("URLButton"); addToContainers("ServiceButton"); addToContainers("ServiceMenuButton"); addToContainers("ExecButton"); int id = 0; QValueList<PanelMenuItemInfo> items; for (BaseContainer::Iterator it = containers.begin(); it != containers.end(); ++it) { items.append(PanelMenuItemInfo((*it)->icon(), (*it)->visibleName(), id)); id++; } qHeapSort(items); for (QValueList<PanelMenuItemInfo>::iterator it = items.begin(); it != items.end(); ++it) { (*it).plug(this); } if (containers.count() > 1) { insertSeparator(); insertItem(i18n("All"), this, SLOT(slotRemoveAll()), 0, id); } }
// public void kpDocumentMetaInfo::printDebug (const QString &prefix) const { const QString usedPrefix = !prefix.isEmpty () ? prefix + QString::fromLatin1 (":") : QString::null; kdDebug () << usedPrefix << endl; kdDebug () << "dotsPerMeter X=" << dotsPerMeterX () << " Y=" << dotsPerMeterY () << " offset=" << offset () << endl; QValueList <QImageTextKeyLang> keyList = textList (); for (QValueList <QImageTextKeyLang>::const_iterator it = keyList.begin (); it != keyList.end (); it++) { kdDebug () << "key=" << (*it).key << " lang=" << (*it).lang << " text=" << text (*it) << endl; } kdDebug () << usedPrefix << "ENDS" << endl; }
void CDDBConfigWidget::showMirrorList() { KCDDB::Sites s; QValueList<KCDDB::Mirror> sites = s.siteList(); QMap<QString, KCDDB::Mirror> keys; for (QValueList<KCDDB::Mirror>::Iterator it = sites.begin(); it != sites.end(); ++it) if ((*it).transport == KCDDB::Lookup::CDDBP) keys[(*it).address + "(CDDBP, " + QString::number((*it).port) + ") " + (*it).description] = *it; else keys[(*it).address + "(HTTP, " + QString::number((*it).port) + ") " + (*it).description] = *it; bool ok; if (keys.isEmpty()) { KMessageBox::information(this, i18n("Could not fetch mirror list."), i18n("Could Not Fetch")); return; } QStringList result = KInputDialog::getItemList(i18n("Select mirror"), i18n("Select one of these mirrors"), keys.keys(), QStringList(), false, &ok, this); if (ok && result.count() == 1) { KCDDB::Mirror m = keys[*(result.begin())]; kcfg_lookupTransport->setCurrentItem(m.transport == KCDDB::Lookup::CDDBP ? 0 : 1); kcfg_hostname->setText(m.address); kcfg_port->setValue(m.port); } }
void ClusterView::drawClusters(QPainter& painter,const QValueList<int>& clustersList,bool drawCircles){ //Loop on the clusters to be drawn QValueList<int>::const_iterator clusterIterator; ItemColors& clusterColors = doc.clusterColors(); Data& clusteringData = doc.data(); for(clusterIterator = clustersList.begin(); clusterIterator != clustersList.end(); ++clusterIterator){ //Get the color associated with the cluster and set the color to use to this color painter.setPen(clusterColors.color(*clusterIterator)); //Get the iterator on the spikes of the current cluster Data::Iterator spikeIterator = clusteringData.iterator(static_cast<dataType>(*clusterIterator)); //Iterate over the spikes of the cluster and draw them if(drawCircles) for(;spikeIterator.hasNext();spikeIterator.next()){ QPoint point = spikeIterator(dimensionX,dimensionY); painter.setBrush(clusterColors.color(*clusterIterator)); painter.drawEllipse(point.x() - 1,point.y() - 1,2,2); } else for(;spikeIterator.hasNext();spikeIterator.next()){ painter.drawPoint(spikeIterator(dimensionX,dimensionY)); } } painter.setBrush(NoBrush); }
void MrmlPart::parseQueryResult( QDomElement& queryResult ) { QDomNode child = queryResult.firstChild(); for ( ; !child.isNull(); child = child.nextSibling() ) { if ( child.isElement() ) { QDomElement elem = child.toElement(); QString tagName = elem.tagName(); if ( tagName == "query-result-element-list" ) { QValueList<QDomElement> list = KMrml::directChildElements( elem, "query-result-element" ); QValueListConstIterator<QDomElement> it = list.begin(); for ( ; it != list.end(); ++it ) { QDomNamedNodeMap a = (*it).attributes(); m_view->addItem( KURL( (*it).attribute("image-location" ) ), KURL( (*it).attribute("thumbnail-location" ) ), (*it).attribute("calculated-similarity")); } } else if ( tagName == "query-result" ) parseQueryResult( elem ); } } }
void UmlClass::generate_formals(QTextOStream & f) { QValueList<UmlFormalParameter> fs = formals(); if (! fs.isEmpty()) { QValueList<UmlFormalParameter>::Iterator it; const char * sep = "<"; for (it = fs.begin(); it != fs.end(); it++) { UmlFormalParameter & p = *it; f << sep; sep = ", "; f << p.name(); const UmlTypeSpec & t = p.extend(); if (t.type != 0) { f << " extends "; t.type->write(f); } else if (! t.explicit_type.isEmpty()) f << " extends " << JavaSettings::type(t.explicit_type); } f << ">"; } }
QPtrList<KAction> KDataToolAction::dataToolActionList( const QValueList<KDataToolInfo> & tools, const QObject *receiver, const char* slot ) { QPtrList<KAction> actionList; if ( tools.isEmpty() ) return actionList; actionList.append( new KActionSeparator() ); QValueList<KDataToolInfo>::ConstIterator entry = tools.begin(); for( ; entry != tools.end(); ++entry ) { QStringList userCommands = (*entry).userCommands(); QStringList commands = (*entry).commands(); Q_ASSERT(!commands.isEmpty()); if ( commands.count() != userCommands.count() ) kdWarning() << "KDataTool desktop file error (" << (*entry).service()->entryPath() << "). " << commands.count() << " commands and " << userCommands.count() << " descriptions." << endl; QStringList::ConstIterator uit = userCommands.begin(); QStringList::ConstIterator cit = commands.begin(); for (; uit != userCommands.end() && cit != commands.end(); ++uit, ++cit ) { //kdDebug() << "creating action " << *uit << " " << *cit << endl; KDataToolAction * action = new KDataToolAction( *uit, *entry, *cit ); connect( action, SIGNAL( toolActivated( const KDataToolInfo &, const QString & ) ), receiver, slot ); actionList.append( action ); } } return actionList; }
void KoZoomAction::setZoom( const QString& text ) { bool ok = false; QString t = text; int zoom = t.remove( '%' ).toInt( &ok ); // where we'll store sorted new zoom values QValueList<int> list; if( zoom > 10 ) list.append( zoom ); // "Captured" non-empty sequence of digits QRegExp regexp("(\\d+)"); const QStringList itemsList( items() ); for( QStringList::ConstIterator it = itemsList.begin(); it != itemsList.end(); ++it ) { regexp.search( *it ); const int val=regexp.cap(1).toInt( &ok ); //zoom : limit inferior=10 if( ok && val>9 && list.contains( val )==0 ) list.append( val ); } qHeapSort( list ); // update items with new sorted zoom values QStringList values; for (QValueList<int>::Iterator it = list.begin(); it != list.end(); ++it ) values.append( i18n("%1%").arg(*it) ); setItems( values ); QString zoomStr = i18n("%1%").arg( zoom ); setCurrentItem( values.findIndex( zoomStr ) ); }
void LibraryWindow::open(QFile *file) { // FIX: this is copy & paste code from project.cpp if (file->open(IO_ReadOnly)) { QDomDocument document; if (document.setContent(file)) { QDomNodeList mList = document.elementsByTagName("model"); if (mList.count() == 1) { QDomNodeList bList = mList.item(0).toElement().elementsByTagName("blocks"); if (bList.count() == 1) { // create model instances QDomElement element = bList.item(0).toElement(); QValueList<AbstractModel *> l = ModelFactory::generate(element); for (QValueList<AbstractModel *>::Iterator it = l.begin(); it != l.end(); ++it) { add(*it); } } } } file->close(); modified_ = false; } }
void MainWindow::loadSites() { QStringList strsites; QValueList<SiteSettings*> sitesList = ProtoeditorSettings::self()->siteSettingsList(); QValueList<SiteSettings*>::iterator it; for(it = sitesList.begin(); it != sitesList.end(); ++it) { strsites << (*it)->name(); } m_siteAction->setItems(strsites); if(strsites.count()) { m_siteAction->setCurrentItem(0); //note 1: KSelectAction doesn't emit activated() when calling setCurrentItem() ProtoeditorSettings::self()->slotCurrentSiteChanged(m_siteAction->currentText()); } //note 2: KSelectAction doesn't updates its combo width, so we have to call this m_siteAction->setComboWidth(150); }