void ButtonBar::deshrink(int preferredDimension, int actualDimension) { if (!preferredDimension) return; m_shrinked = true; uint textLength = 0; QValueList<uint> texts; uint maxLength = 0; for (ButtonList::const_iterator it = m_buttons.constBegin(); it != m_buttons.constEnd(); ++it) { uint length = (*it)->text().length(); maxLength = length > maxLength ? length : maxLength ; texts.append(length); textLength += length; } uint newPreferredLength = actualDimension * textLength / preferredDimension; if (newPreferredLength <= textLength) return; uint newTextLength; uint prevTextLength = 0; do { newTextLength = 0; int i = 0; for (QValueList<uint>::iterator it = texts.begin(); it != texts.end(); ++it, i++) { if (m_buttons[i]->text().contains("...")) (*it)++; newTextLength += *it; } if (newTextLength == prevTextLength) break; prevTextLength = newTextLength; } while (newTextLength < newPreferredLength); int i = 0; for (ButtonList::iterator it = m_buttons.begin(); it != m_buttons.end(); ++it) { if (texts[i] >= (*it)->realText().length()) (*it)->setText((*it)->realText()); else (*it)->setText(KStringHandler::rsqueeze((*it)->realText(), texts[i])); (*it)->updateSize(); ++i; } }
QDBusDataList::QDBusDataList(const QValueList< Q_UINT64 > &other) : d(new Private()) { d->type = QDBusData::UInt64; if(other.isEmpty()) return; QValueList< Q_UINT64 >::const_iterator it = other.begin(); QValueList< Q_UINT64 >::const_iterator endIt = other.end(); for(; it != endIt; ++it) { d->list << QDBusData::fromUInt64(*it); } }
void QuestionSetMultiplication::initQuestions( Question::List &questions ) { QValueList<int> rows = Prefs::multiplicationRows(); QValueList<int>::ConstIterator it; for( it = rows.begin(); it != rows.end(); ++it ) { int a = *it; for( int b = 1; b <= 10; ++b ) { Question q; q.setQuestion( QString::number( b ) + " \xb7 " + QString::number( a ) ); q.setAnswer( QString::number( a * b ) ); questions.append( q ); } } }
void DebuggerManager::slotNewDocument() { //if the new document has breakpoints, mark them. QValueList<DebuggerBreakpoint*> bplist = m_window->breakpointListView()->breakpointsFrom( m_window->tabEditor()->currentDocumentURL()); QValueList<DebuggerBreakpoint*>::iterator it; for(it = bplist.begin(); it != bplist.end(); ++it) { m_window->tabEditor()->markActiveBreakpoint((*it)->url(), (*it)->line()); } }
void PluginSelectDialog::init( ) { const QValueList<KDevPlugin*> loadedPlugins = PluginController::getInstance()->loadedPlugins(); QStringList loadedPluginDesktopNames; QValueList<KDevPlugin*>::ConstIterator it = loadedPlugins.begin(); while( it != loadedPlugins.end() ) { loadedPluginDesktopNames << (*it)->instance()->instanceName(); ++it; } kdDebug(9000) << " *** loadedPluginDesktopNames: " << loadedPluginDesktopNames << endl; KTrader::OfferList localOffers; if ( ProjectManager::getInstance()->projectLoaded() ) { localOffers = PluginController::getInstance()->engine().offers( PluginController::getInstance()->currentProfile(), ProfileEngine::Project ); } KTrader::OfferList globalOffers = PluginController::getInstance()->engine().offers( PluginController::getInstance()->currentProfile(), ProfileEngine::Global); KTrader::OfferList offers = localOffers + globalOffers; for (KTrader::OfferList::ConstIterator it = offers.begin(); it != offers.end(); ++it) { // parse out any existing url to make it clickable QString Comment = (*it)->comment(); QRegExp re("\\bhttp://[\\S]*"); re.search( Comment ); Comment.replace( re, "" ); QString url; if ( re.pos() > -1 ) { url = re.cap(); } PluginItem *item = new PluginItem( plugin_list, (*it)->desktopEntryName(), (*it)->genericName(), Comment, url ); item->setOn( loadedPluginDesktopNames.contains( (*it)->desktopEntryName() ) ); kdDebug(9000) << (*it)->desktopEntryName() << " : " << (loadedPluginDesktopNames.contains( (*it)->desktopEntryName() ) ? "YES" : "NO" ) << endl; } QListViewItem * first = plugin_list->firstChild(); if ( first ) { plugin_list->setSelected( first, true ); } }
QDBusDataList::QDBusDataList(const QValueList< double > &other) : d(new Private()) { d->type = QDBusData::Double; if(other.isEmpty()) return; QValueList< double >::const_iterator it = other.begin(); QValueList< double >::const_iterator endIt = other.end(); for(; it != endIt; ++it) { d->list << QDBusData::fromDouble(*it); } }
void QSplitter::setSizes( QValueList<int> list ) { processChildEvents(); QValueList<int>::Iterator it = list.begin(); QSplitterLayoutStruct *s = data->list.first(); while ( s && it != list.end() ) { if ( !s->isSplitter ) { s->sizer = *it; ++it; } s = data->list.next(); } doResize(); }
void VariablesListView::reexpandItems() { //if we don't do this, m_expanded will have duplicates QValueList<QString> paths = m_expanded; m_expanded.clear(); VariablesListViewItem* item; QValueList<QString>::iterator it; for(it = paths.begin(); it != paths.end(); it++) { item = getItemFromPath(*it); if(item) item->setOpen(true); } }
QValueList<Event> DateBookDB::getEvents( const QDateTime &start ) { QValueList<Event> day = getEvents(start.date(),start.date()); QValueListConstIterator<Event> it; QDateTime dtTmp; QValueList<Event> tmpList; for (it = day.begin(); it != day.end(); ++it ) { dtTmp = (*it).start(TRUE); if ( dtTmp == start ) tmpList.append( *it ); } return tmpList; }
QDBusDataList::QDBusDataList(const QValueList< QDBusObjectPath > &other) : d(new Private()) { d->type = QDBusData::ObjectPath; if(other.isEmpty()) return; QValueList< QDBusObjectPath >::const_iterator it = other.begin(); QValueList< QDBusObjectPath >::const_iterator endIt = other.end(); for(; it != endIt; ++it) { d->list << QDBusData::fromObjectPath(*it); } }
void EditorView::updateKeyTree ( ) { QValueList<QString> temp = openedKeys; openedKeys.clear ( ); keyTree->clear ( ); KeySet *roots = ksNew ( ); if ( kdbGetRootKeys ( roots ) ) { perror ( "opening roots" ); } ksSort ( roots ); ksRewind ( roots ); ::Key *k = ksNext ( roots ); while ( k ) { addRootItem( k ); k = ksNext ( roots ); } ksDel ( roots ); if ( temp.isEmpty ( ) ) return; QValueList<QString>::iterator it = temp.begin ( ); while ( it != temp.end ( ) ) { QListViewItem * item = getItem ( *it ); if ( item ) { if ( *it == keyName ( item ) ) { keyTree->setOpen ( item, true ); //cout << "ok" << endl; } else cout << "f**k " << keyName ( item ) << " != " << *it << endl; } /*if ( item->isOpen ( ) ) cout << "not open" << endl;*/ //openKeyDir ( item ); ++it; } }
QDBusDataList::QDBusDataList(const QValueList<QDBusVariant>& other) : d(new Private()) { d->type = QDBusData::Variant; if (other.isEmpty()) return; QValueList<QDBusVariant>::ConstIterator it = other.begin(); QValueList<QDBusVariant>::ConstIterator endIt = other.end(); for (; it != endIt; ++it) { d->list << QDBusData::fromVariant(*it); } }
void ConnectionEditor::signalChanged() { QCString signal = signalBox->currentText().latin1(); if ( !signal.data() ) return; signal = normalizeSignalSlot( signal.data() ); slotBox->clear(); if ( signalBox->currentText().isEmpty() ) return; int n = receiver->metaObject()->numSlots( TRUE ); for( int i = 0; i < n; ++i ) { // accept only public slots. For the form window, also accept protected slots QMetaData* md = receiver->metaObject()->slot( i, TRUE ); if ( ( (receiver->metaObject()->slot_access( i, TRUE ) == QMetaData::Public) || ( formWindow->isMainContainer( (QWidget*)receiver ) && receiver->metaObject()->slot_access(i, TRUE) == QMetaData::Protected) ) && !ignoreSlot( md->name ) && checkConnectArgs( signal.data(), receiver, md->name ) ) slotBox->insertItem( md->name ); } if ( formWindow->isMainContainer( (QWidget*)receiver ) ) { QValueList<MetaDataBase::Slot> moreSlots = MetaDataBase::slotList( formWindow ); if ( !moreSlots.isEmpty() ) { for ( QValueList<MetaDataBase::Slot>::Iterator it = moreSlots.begin(); it != moreSlots.end(); ++it ) { QCString s = (*it).slot; if ( !s.data() ) continue; s = normalizeSignalSlot( s.data() ); if ( checkConnectArgs( signal.data(), receiver, s ) ) slotBox->insertItem( QString( (*it).slot ) ); } } } if ( receiver->inherits( "CustomWidget" ) ) { MetaDataBase::CustomWidget *w = ( (CustomWidget*)receiver )->customWidget(); for ( QValueList<MetaDataBase::Slot>::Iterator it = w->lstSlots.begin(); it != w->lstSlots.end(); ++it ) { QCString s = (*it).slot; if ( !s.data() ) continue; s = normalizeSignalSlot( s.data() ); if ( checkConnectArgs( signal.data(), receiver, s ) ) slotBox->insertItem( QString( (*it).slot ) ); } } slotsChanged(); }
QValueList<EffectiveEvent> DateBookDB::getEffectiveEvents( const QDateTime &dt) { QValueList<EffectiveEvent> day = getEffectiveEvents(dt.date(), dt.date()); QValueListConstIterator<EffectiveEvent> it; QValueList<EffectiveEvent> tmpList; QDateTime dtTmp; for (it = day.begin(); it != day.end(); ++it ) { dtTmp = QDateTime( (*it).date(), (*it).start() ); // at the moment we don't have second granularity, be nice about that.. if ( QABS(dt.secsTo(dtTmp)) < 60 ) tmpList.append( *it ); } return tmpList; }
// Clear the job list and emit signals void MoodServer::clearJobs( void ) { // We don't want to emit jobEvent (or really do anything // external) while the mutex is locked. m_mutex.lock(); QValueList<ProcData> queueCopy = QDeepCopy< QValueList<ProcData> > ( m_jobQueue ); m_jobQueue.clear(); m_mutex.unlock(); QValueList<ProcData>::iterator it; for( it = queueCopy.begin(); it != queueCopy.end(); ++it ) emit jobEvent( (*it).m_url, Moodbar::JobStateFailed ); }
void Core::slotAllPluginsLoaded() { QValueList<KPluginInfo*> plugins = m_pluginManager->availablePlugins(); kdDebug()<<"Number of available plugins is "<< plugins.count() <<endl; for ( QValueList<KPluginInfo*>::iterator it = plugins.begin(); it != plugins.end(); ++it ) { KPluginInfo *i = ( *it ); kdDebug()<<"\tAvailable plugin "<< i->pluginName() <<", comment = "<< i->comment() <<endl; } if ( !m_stack->visibleWidget() ) { m_pluginManager->loadPlugin( "komposer_defaulteditor", PluginManager::LoadAsync ); } }
void JumpButtonBar::sortListLocaleAware( QStringList &list ) { QValueList<SortContainer> sortList; QStringList::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) sortList.append( SortContainer( *it ) ); qHeapSort( sortList ); list.clear(); QValueList<SortContainer>::ConstIterator sortIt; for ( sortIt = sortList.begin(); sortIt != sortList.end(); ++sortIt ) list.append( (*sortIt).data() ); }
void ResourceExchange::slotMonitorNotify(const QValueList<long> &IDs, const QValueList<KURL> &urls) { kdDebug() << "ResourceExchange::slotMonitorNotify()" << endl; QString result; KPIM::ExchangeMonitor::IDList::ConstIterator it; for(it = IDs.begin(); it != IDs.end(); ++it) { if(it == IDs.begin()) result += QString::number((*it)); else result += "," + QString::number((*it)); } kdDebug() << "Got signals for " << result << endl; QValueList<KURL>::ConstIterator it2; for(it2 = urls.begin(); it2 != urls.end(); ++it2) { kdDebug() << "URL: " << (*it2).prettyURL() << endl; } /* Now find out what happened: * One or more of the following: * 1. Event added in period that we think we have cached * 2. Event deleted that we have in cache * 3. Event modified that we have in cache * 4. Something else happened that isn't relevant to us * Update cache, then notify whoever's watching us * We may be able to find (1) and (3) by looking at the * DAV:getlastmodified property * (2) is trickier: we might have to resort to checking * all uids in the cache * Or: put monitors on every event in the cache, so that * we know when one gets deleted or modified * Only look for new events using the global monitor */ }
void MyMoneyForecast::setBudgetAccountList(void) { //get budget accounts QValueList<MyMoneyAccount> accList; accList = budgetAccountList(); QValueList<MyMoneyAccount>::const_iterator accList_t = accList.begin(); for(; accList_t != accList.end(); ++accList_t ) { MyMoneyAccount acc = *accList_t; // check if this is a new account for us if(m_nameIdx[acc.id()] != acc.id()) { m_nameIdx[acc.id()] = acc.id(); } } }
QString SOAP::createCommand(const QString & action,const QString & service,const QValueList<Arg> & args) { QString comm = QString("<?xml version=\"1.0\"?>\r\n" "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">" "<SOAP-ENV:Body>" "<m:%1 xmlns:m=\"%2\">").arg(action).arg(service); for (QValueList<Arg>::const_iterator i = args.begin();i != args.end();i++) { const Arg & a = *i; comm += "<" + a.element + ">" + a.value + "</" + a.element + ">"; } comm += QString("</m:%1></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n").arg(action); return comm; }
void KNCollectionView::addAccount(KNNntpAccount *a) { // add account item KNCollectionViewItem *item = new KNCollectionViewItem(this, KFolderTreeItem::News); a->setListItem(item); item->setOpen(a->wasOpen()); // add groups for this account QValueList<KNGroup *> groups = knGlobals.groupManager()->groupsOfAccount(a); for(QValueList<KNGroup *>::Iterator it = groups.begin(); it != groups.end(); ++it) { KNCollectionViewItem *gitem = new KNCollectionViewItem(item, KFolderTreeItem::News); (*it)->setListItem(gitem); (*it)->updateListItem(); } }
static void writeInterfaceIncludes(const QValueList<Class> interfaces, QTextStream& stream) { stream << "// interface classes includes" << endl; QValueList<Class>::ConstIterator it = interfaces.begin(); QValueList<Class>::ConstIterator endIt = interfaces.end(); for (; it != endIt; ++it) { stream << "#include \"" << (*it).name.lower() << ".h\"" << endl; } stream << "#include \"introspectableinterface.h\"" << endl; stream << endl; }
void OutputWindow::setErrorMessages( const QStringList &errors, const QValueList<uint> &lines, bool clear, const QStringList &locations, const QObjectList &locationObjects ) { if ( clear ) errorView->clear(); QStringList::ConstIterator mit = errors.begin(); QValueList<uint>::ConstIterator lit = lines.begin(); QStringList::ConstIterator it = locations.begin(); QObjectList objects = (QObjectList)locationObjects; QObject *o = objects.first(); QListViewItem *after = 0; for ( ; lit != lines.end() && mit != errors.end(); ++lit, ++mit, ++it, o = objects.next() ) after = new ErrorItem( errorView, after, *mit, *lit, *it, o ); setCurrentPage( 1 ); }
void MBOXwrapper::deleteMails(mailmbox_folder*f,const QValueList<RecMailP> &target) { if (!f) return; int r; QValueList<RecMailP>::ConstIterator it; for (it=target.begin(); it != target.end();++it) { r = mailmbox_delete_msg(f,(*it)->getNumber()); if (r!=MAILMBOX_NO_ERROR) { odebug << "error delete mail" << oendl; } } r = mailmbox_expunge(f); if (r != MAILMBOX_NO_ERROR) { odebug << "error expunge mailbox" << oendl; } }
void AddressbookHandler::fakeAddresseeListFromDevice( KABC::Addressee::List &mAddresseeList, QValueList<uint32_t> &idList ) { for ( QValueList<uint32_t>::const_iterator it = idList.begin(); it != idList.end(); ++it ) { KABC::Addressee addr; QString konId = "RRA-ID-" + QString::number( *it, 16 ).rightJustify( 8, '0' ); QString kdeId; if ((kdeId = mUidHelper->kdeId("SynCEAddressbook", konId, "---")) != "---") { addr.setUid(kdeId); mUidHelper->removeId("SynCEAddressbook", addr.uid()); mAddresseeList.push_back( addr ); } kdDebug(2120) << "Contact: " << konId << " -- " << kdeId << endl; } }
QDBusData QDBusData::fromStruct(const QValueList<QDBusData>& memberList) { QDBusData data; QValueList<QDBusData>::ConstIterator it = memberList.begin(); QValueList<QDBusData>::ConstIterator endIt = memberList.end(); for (; it != endIt; ++it) { if ((*it).d->type == Invalid) return data; } data.d->type = QDBusData::Struct; data.d->value.pointer = new QValueList<QDBusData>(memberList); return data; }
void ActivityActionCanvas::check_pins() { // add missing pins const QValueList<BrowserPin *> brpins = ((BrowserActivityAction *) browser_node)->get_pins(); QValueList<BrowserPin *>::ConstIterator iter; double zoom = the_canvas()->zoom(); int sz = (int) (zoom * PIN_SIZE); int six = (int) (zoom * 6); int xl = (int) x() - sz; int xr = rect().right(); int ymin = (int) y() + six; int ymax = (int) y() + height() - six - sz; int yr = ymin; int yl = ymin; sz += six; for (iter = brpins.begin(); iter != brpins.end(); ++iter) { QValueList<PinCanvas *>::ConstIterator itershown; for (itershown = pins.begin(); itershown != pins.end(); ++itershown) if ((*itershown)->get_bn() == *iter) break; if (itershown == pins.end()) { // add it PinCanvas * pc; if (((PinData *) (*iter)->get_data())->get_dir() == UmlIn) { pc = new PinCanvas(*iter, the_canvas(), xl, yl, 0, this); yl = (yl + sz); if (yl > ymax) yl = ymin + 2; } else { pc = new PinCanvas(*iter, the_canvas(), xr, yr, 0, this); yr = (yr + sz); if (yr > ymax) yr = ymin + 2; } pins.append(pc); pc->update(); pc->show(); } } }
void ResourceSlox::slotUploadResult( KIO::Job *job ) { kdDebug() << "ResourceSlox::slotUploadResult()" << endl; if ( job->error() ) { job->showErrorDialog( 0 ); } else { kdDebug() << "ResourceSlox::slotUploadResult() success" << endl; QDomDocument doc = mUploadJob->response(); kdDebug() << k_funcinfo << "Upload result: " << endl; kdDebug() << doc.toString() << endl; QValueList<SloxItem> items = WebdavHandler::getSloxItems( this, doc ); QValueList<SloxItem>::ConstIterator it; for( it = items.begin(); it != items.end(); ++it ) { SloxItem item = *it; if ( !item.response.contains( "200" ) ) { savingError( this, item.response + "\n" + item.responseDescription ); continue; } if ( item.status == SloxItem::New ) { QMap<QString,Addressee>::Iterator search_res; search_res = mAddrMap.find( item.clientId ); if ( search_res != mAddrMap.end() ) { // use the id provided by the server Addressee a = *search_res; mAddrMap.remove( search_res ); a.setUid( "kresources_slox_kabc_" + item.sloxId ); a.setResource( this ); a.setChanged( false ); mAddrMap.replace( a.uid(), a ); saveCache(); } } } } clearChange( mUploadAddressee ); mUploadJob = 0; mUploadProgress->setComplete(); mUploadProgress = 0; uploadContacts(); }
void ProgressItem::cancel() { if ( mCanceled || !mCanBeCanceled ) return; kdDebug(5300) << "ProgressItem::cancel() - " << label() << endl; mCanceled = true; // Cancel all children. QValueList<ProgressItem*> kids = mChildren.keys(); QValueList<ProgressItem*>::Iterator it( kids.begin() ); QValueList<ProgressItem*>::Iterator end( kids.end() ); for ( ; it != end; it++ ) { ProgressItem *kid = *it; if ( kid->canBeCanceled() ) kid->cancel(); } setStatus( i18n( "Aborting..." ) ); emit progressItemCanceled( this ); }
// Set the free/busy periods for this attendee void FreeBusyItem::setFreeBusyPeriods( FreeBusy* fb ) { if( fb ) { // Clean out the old entries for( KDGanttViewItem* it = firstChild(); it; it = firstChild() ) delete it; // Evaluate free/busy information QValueList<KCal::Period> busyPeriods = fb->busyPeriods(); for( QValueList<KCal::Period>::Iterator it = busyPeriods.begin(); it != busyPeriods.end(); ++it ) { KDGanttViewTaskItem* newSubItem = new KDGanttViewTaskItem( this ); newSubItem->setStartTime( (*it).start() ); newSubItem->setEndTime( (*it).end() ); newSubItem->setColors( Qt::red, Qt::red, Qt::red ); QString toolTip; if ( !(*it).summary().isEmpty() ) toolTip += "<b>" + (*it).summary() + "</b><br/>"; if ( !(*it).location().isEmpty() ) toolTip += i18n( "Location: %1" ).arg( (*it).location() ); if ( !toolTip.isEmpty() ) newSubItem->setTooltipText( toolTip ); } setFreeBusy( fb ); setShowNoInformation( false ); } else { // No free/busy information //debug only start // int ii ; // QDateTime cur = QDateTime::currentDateTime(); // for( ii = 0; ii < 10 ;++ii ) { // KDGanttViewTaskItem* newSubItem = new KDGanttViewTaskItem( this ); // cur = cur.addSecs( 7200 ); // newSubItem->setStartTime( cur ); // cur = cur.addSecs( 7200 ); // newSubItem->setEndTime( cur ); // newSubItem->setColors( Qt::red, Qt::red, Qt::red ); // } //debug only end setFreeBusy( 0 ); setShowNoInformation( true ); } // We are no longer downloading mIsDownloading = false; }