Exemple #1
0
void KTouchStatistics::run(const KURL& currentLecture, const KTouchStatisticsData& stats,
	const KTouchLevelStats& currLevelStats,
	const KTouchSessionStats& currSessionStats)
{
//	kdDebug() << "[KTouchStatistics::run]" << endl;
//	kdDebug() << "  currentLecture = '" << currentLecture << "'" << endl;

	// fill lecture combo with data
	// loop over all lecturestatistics
	lectureCombo->clear();
	QMapConstIterator<KURL, KTouchLectureStats> it = stats.m_lectureStats.begin();
	m_currentIndex = 0;
	while (it != stats.m_lectureStats.end()) {
		QString t = it.data().m_lectureTitle;
		// if current lecture, remember index and adjust text
		if (it.key() == currentLecture ||
			currentLecture.isEmpty() && it.key().url()=="default")
		{
			m_currentIndex = lectureCombo->count();
			if (t == "default")   t = i18n("Default level...");
			lectureLabel1->setText(t);
			lectureLabel2->setText(t);
			t = i18n("***current***  ") + t;
		}
		lectureCombo->insertItem(t);
		++it;
	}
	if (lectureCombo->count()==0) {
		// this shouldn't happen if the dialog is run with proper data
		KMessageBox::information(this, i18n("No statistics data available yet!"));
		return;
	}

	// remember stats
	m_allStats = stats;
	m_currLevelStats = currLevelStats;
	m_currSessionStats = currSessionStats;
	// modify current lecture entry
	lectureCombo->setCurrentItem(m_currentIndex);
	lectureActivated(m_currentIndex);
	m_lectureIndex = m_currentIndex;
	
	// update the current tabs with current session/level data
	updateCurrentSessionTab();
	updateCurrentLevelTab();
	// set current session as current tab
	tabWidget->showPage(currentTab);
	exec();
}
void ODateBookAccessBackend_SQL::initFields()
{

	// This map contains the translation of the fieldtype id's to
	// the names of the table columns
	m_fieldMap.insert( OEvent::FUid, "uid" );
	m_fieldMap.insert( OEvent::FCategories, "Categories" );
	m_fieldMap.insert( OEvent::FDescription, "Description" );
	m_fieldMap.insert( OEvent::FLocation, "Location" );
	m_fieldMap.insert( OEvent::FType, "Type" );
	m_fieldMap.insert( OEvent::FAlarm, "Alarm" );
	m_fieldMap.insert( OEvent::FSound, "Sound" );
	m_fieldMap.insert( OEvent::FRType, "RType" );
	m_fieldMap.insert( OEvent::FRWeekdays, "RWeekdays" );
	m_fieldMap.insert( OEvent::FRPosition, "RPosition" );
	m_fieldMap.insert( OEvent::FRFreq, "RFreq" );
	m_fieldMap.insert( OEvent::FRHasEndDate, "RHasEndDate" );
	m_fieldMap.insert( OEvent::FREndDate, "REndDate" );
	m_fieldMap.insert( OEvent::FRCreated, "RCreated" );
	m_fieldMap.insert( OEvent::FRExceptions, "RExceptions" );
	m_fieldMap.insert( OEvent::FStart, "Start" );
	m_fieldMap.insert( OEvent::FEnd, "End" );
	m_fieldMap.insert( OEvent::FNote, "Note" );
	m_fieldMap.insert( OEvent::FTimeZone, "TimeZone" );
	m_fieldMap.insert( OEvent::FRecParent, "RecParent" );
	m_fieldMap.insert( OEvent::FRecChildren, "Recchildren" );

	// Create a map that maps the column name to the id
	QMapConstIterator<int, QString> it;
	for ( it = ++m_fieldMap.begin(); it != m_fieldMap.end(); ++it ){
		m_reverseFieldMap.insert( it.data(), it.key() );
	}

}
Exemple #3
0
void KDModule::propagateUsers()
{
    groupmap.clear();
    emit clearUsers();
    QMap< QString, int > lusers;
    QMapConstIterator< QString, QPair< int, QStringList > > it;
    QStringList::ConstIterator jt;
    QMap< QString, int >::Iterator gmapi;
    for(it = usermap.begin(); it != usermap.end(); ++it)
    {
        int uid = it.data().first;
        if(!uid || (uid >= minshowuid && uid <= maxshowuid))
        {
            lusers[it.key()] = uid;
            for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt)
                if((gmapi = groupmap.find(*jt)) == groupmap.end())
                {
                    groupmap[*jt] = 1;
                    lusers['@' + *jt] = -uid;
                }
                else
                    (*gmapi)++;
        }
    }
    emit addUsers(lusers);
    updateOK = true;
}
QString ParserData::keywordToString(Parse::Keyword k) const
{
  for (QMapConstIterator<QString, Keyword> it = m_keywords.begin(); it != m_keywords.end(); ++it) 
    if (it.data() == k)
      return it.key();
  return QString();
}
Exemple #5
0
void KDModule::slotMinMaxUID(int min, int max)
{
    if(updateOK)
    {
        QMap< QString, int > alusers, dlusers;
        QMapConstIterator< QString, QPair< int, QStringList > > it;
        QStringList::ConstIterator jt;
        QMap< QString, int >::Iterator gmapi;
        for(it = usermap.begin(); it != usermap.end(); ++it)
        {
            int uid = it.data().first;
            if(!uid)
                continue;
            if((uid >= minshowuid && uid <= maxshowuid) && !(uid >= min && uid <= max))
            {
                dlusers[it.key()] = uid;
                for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt)
                {
                    gmapi = groupmap.find(*jt);
                    if(!--(*gmapi))
                    {
                        groupmap.remove(gmapi);
                        dlusers['@' + *jt] = -uid;
                    }
                }
            }
            else if((uid >= min && uid <= max) && !(uid >= minshowuid && uid <= maxshowuid))
            {
                alusers[it.key()] = uid;
                for(jt = it.data().second.begin(); jt != it.data().second.end(); ++jt)
                    if((gmapi = groupmap.find(*jt)) == groupmap.end())
                    {
                        groupmap[*jt] = 1;
                        alusers['@' + *jt] = -uid;
                    }
                    else
                        (*gmapi)++;
            }
        }
        emit delUsers(dlusers);
        emit addUsers(alusers);
    }
    minshowuid = min;
    maxshowuid = max;
}
Exemple #6
0
void Template::compose( const TemplateManager & tm )
{

    QMapConstIterator <QString, QString> i =
        const_cast<QMap<QString, QString> &>(
                d->requestedNestedTemplates).begin();

    for( ; i != const_cast<QMap<QString, QString> &>(
                d->requestedNestedTemplates).end(); ++i ) {

        //try to acquire template of a given type
        Template * t = tm.instantiate( i.data(), getLoggerPtr(),
                d->requestedNestedTemplateLibs[ i.key() ] );

        if( t != NULL ) {
            // recursively compose even our nested templates
            t->compose( tm );
            // and put our template to our internal hash
            registerNestedTemplate( i.key(), t );
        }
    }
}