QMultiMap<int, IOptionsDialogWidget *> ClientInfo::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsDialogWidget *> widgets;
	if (FOptionsManager && ANodeId == OPN_COMMON)
	{
		widgets.insertMulti(OWO_COMMON_SENDCLIENTINFO, FOptionsManager->newOptionsDialogWidget(Options::node(OPV_COMMON_SHAREOSVERSION),tr("Share information about your OS version"),AParent));
	}
	return widgets;
}
Example #2
0
QMultiMap<QString, QString> KQOAuthManagerPrivate::createTokensFromResponse(QByteArray reply) {
    QMultiMap<QString, QString> result;
    QString replyString(reply);

    QStringList parameterPairs = replyString.split('&', QString::SkipEmptyParts);
    foreach (const QString &parameterPair, parameterPairs) {
        QStringList parameter = parameterPair.split('=');
        result.insert(parameter.value(0), parameter.value(1));
    }
Example #3
0
void ToolScript::remapMaterialKeysToToolKeys(QMultiMap<QString,AMFRegion*>* map) const {
  QMultiMap<QString,AMFRegion*> remap;

  // Scrape all of the regions matching a given material name from the map
  foreach (ToolScriptTool* tool, tools_) {
    QList<AMFRegion*> regions = map->values(tool->materialName());
    foreach (AMFRegion* region, regions) {
      remap.insert(tool->name(), region);
    }
Example #4
0
void Statistics::incrementRankingEntry(QString ranking, QString key){
    if(!this->_rankings.contains(ranking)){
        this->_rankings.insert(ranking, new QMultiMap<quint64, QString>());
        this->_rankingsCounter.insert(ranking,0);
    }

    //"Reinigen"?
    if(this->_rankingsCounter[ranking] > 1000){
        for(int i = 0; i < 900;++i){
            QMultiMap<quint64, QString>::const_iterator beg = this->_rankings.value(ranking)->begin();
            this->_rankings.value(ranking)->remove(beg.key(), beg.value());
        }

        this->_rankingsCounter[ranking] = 100;

        //Durchgehen und den Wert auf 25% senken
        QMultiMap<quint64, QString>::const_iterator i = this->_rankings.value(ranking)->begin();
        QMultiMap<quint64, QString>::const_iterator end = this->_rankings.value(ranking)->end();

        QMultiMap<quint64, QString> *tmpMap = new QMultiMap<quint64, QString>();

        while(i != end){
            tmpMap->insertMulti(i.key()*0.25, i.value());
            i++;
        }

        //Alte Map löschen
        delete this->_rankings.value(ranking);
        //Neue einsetzen
        this->_rankings[ranking] = tmpMap;
    }

    //Werte durchgehen
    QMultiMap<quint64, QString>::const_iterator it = this->_rankings.value(ranking)->begin();
    QMultiMap<quint64, QString>::const_iterator end = this->_rankings.value(ranking)->end();
    while(it != end){

        //Schlüssel gefunden?
        if(it.value() == key){
            //Wert zwischenspeichern
            uint val = it.key();
            //Alten Wert entfernen
            this->_rankings.value(ranking)->remove(it.key(), it.value());
            //Neu einschreiben
            this->_rankings.value(ranking)->insertMulti(val+1, key);
            return;
        }
        it++;
    }


    //Counter erhöhen
    this->_rankingsCounter[ranking]++;
    //Einfügen
    this->_rankings.value(ranking)->insertMulti(1, key);
}
Example #5
0
  QMultiMap<int, QString> getBackwardKeys()
  {
    QMultiMap<int, QString> result;
    for (QHash<QString, int>::const_iterator it = _keys.begin(); it != _keys.end(); ++it)
    {
      result.insertMulti(it.value(), it.key());
    }

    return result;
  }
Example #6
0
QMultiMap<int, IOptionsWidget *> MessageWidgets::optionsWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsWidget *> widgets;
	if (FOptionsManager && ANodeId == OPN_MESSAGES)
	{
		widgets.insertMulti(OWO_MESSAGES, FOptionsManager->optionsHeaderWidget(QString::null,tr("Select the method of sending messages"),AParent));
		widgets.insertMulti(OWO_MESSAGES, new MessengerOptions(AParent));
	}
	return widgets;
}
QMultiMap<int, IOptionsDialogWidget *> ShortcutManager::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsDialogWidget *> widgets;
	if (ANodeId == OPN_SHORTCUTS)
	{
		widgets.insertMulti(OHO_SHORTCUTS, FOptionsManager->newOptionsDialogHeader(tr("Shortcuts"),AParent));
		widgets.insertMulti(OWO_SHORTCUTS, new ShortcutOptionsWidget(AParent));
	}
	return widgets;
}
Example #8
0
QMultiMap<int, IOptionsDialogWidget *> RosterItemExchange::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsDialogWidget *> widgets;
	if (ANodeId == OPN_ROSTERVIEW)
	{
		widgets.insertMulti(OHO_ROSTER_MANAGEMENT,FOptionsManager->newOptionsDialogHeader(tr("Contacts list management"),AParent));
		widgets.insertMulti(OWO_ROSTER_EXCHANGEAUTO,FOptionsManager->newOptionsDialogWidget(Options::node(OPV_ROSTER_EXCHANGE_AUTOAPPROVEENABLED),tr("Allow gateways and group services manage your contacts list"),AParent));
	}
	return widgets;
}
Example #9
0
/**
 * Removes all but the given properties from the combined properties
 * collected so far.
 */
void RPropertyEditor::removeAllButThese(
        const QMultiMap<QString, QString>& propertyTitles, bool customOnly) {

    // iterate through all groups of properties (e.g. "Start Point", "End Point", ...):
    QStringList removableGroups;
    RPropertyGroupMap::iterator it;
    for (it = combinedProperties.begin(); it != combinedProperties.end(); ++it) {

        // iterate through all properties in the current group (e.g. "X", "Y"):
        QStringList removableProperties;
        RPropertyMap::iterator it2;
        for (it2 = it.value().begin(); it2 != it.value().end(); ++it2) {
            if (customOnly && !it2.value().second.getPropertyTypeId().isCustom()) {
                continue;
            }

            bool keep = false;

            // check if the current property is among the given properties
            // we want to keep:
            QMultiMap<QString, QString>::const_iterator it3;
            for (it3 = propertyTitles.begin(); it3 != propertyTitles.end(); ++it3) {
                if (it3.key() == it.key() && it3.value() == it2.key()) {
                    keep = true;
                    break;
                }
            }

            if (keep == false) {
                // schedule property for removal:
                removableProperties.push_back(it2.key());
            }
        }

        // remove all properties in the current group that are scheduled for removal:
        QStringList::iterator it4;
        for (it4 = removableProperties.begin(); it4
                != removableProperties.end(); ++it4) {
            it.value().remove(*it4);
            propertyOrder[it.key()].removeAll(*it4);
        }

        // schedule empty groups for removal:
        if (it.value().empty()) {
            removableGroups.push_back(it.key());
        }
    }

    // remove all groups that are scheduled for removal:
    QStringList::iterator it5;
    for (it5 = removableGroups.begin(); it5 != removableGroups.end(); ++it5) {
        combinedProperties.remove(*it5);
        groupOrder.removeAll(*it5);
    }
}
Example #10
0
void QgsSelectedFeature::moveSelectedVertexes( const QgsVector &v )
{
  int nUpdates = 0;
  foreach ( QgsVertexEntry *entry, mVertexMap )
  {
    if ( entry->isSelected() )
      nUpdates++;
  }

  if ( nUpdates == 0 )
    return;

  mVlayer->beginEditCommand( QObject::tr( "Moved vertices" ) );
  int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );

  beginGeometryChange();

  QMultiMap<double, QgsSnappingResult> currentResultList;
  for ( int i = mVertexMap.size() - 1; i > -1 && nUpdates > 0; i-- )
  {
    QgsVertexEntry *entry = mVertexMap.value( i, 0 );
    if ( !entry || !entry->isSelected() )
      continue;

    if ( topologicalEditing )
    {
      // snap from current vertex
      currentResultList.clear();
      mVlayer->snapWithContext( entry->point(), ZERO_TOLERANCE, currentResultList, QgsSnapper::SnapToVertex );
    }

    // only last update should trigger the geometry update
    // as vertex selection gets lost on the update
    if ( --nUpdates == 0 )
      endGeometryChange();

    QgsPoint p = entry->point() + v;
    mVlayer->moveVertex( p.x(), p.y(), mFeatureId, i );

    if ( topologicalEditing )
    {
      QMultiMap<double, QgsSnappingResult>::iterator resultIt =  currentResultList.begin();

      for ( ; resultIt != currentResultList.end(); ++resultIt )
      {
        // move all other
        if ( mFeatureId !=  resultIt.value().snappedAtGeometry )
          mVlayer->moveVertex( p.x(), p.y(),
                               resultIt.value().snappedAtGeometry, resultIt.value().snappedVertexNr );
      }
    }
  }

  mVlayer->endEditCommand();
}
Example #11
0
void Device::reloadPlugins()
{
    QHash<QString, KdeConnectPlugin*> newPluginMap;
    QMultiMap<QString, KdeConnectPlugin*> newPluginsByIncomingInterface;
    QMultiMap<QString, KdeConnectPlugin*> newPluginsByOutgoingInterface;

    if (isPaired() && isReachable()) { //Do not load any plugin for unpaired devices, nor useless loading them for unreachable devices

        KConfigGroup pluginStates = KSharedConfig::openConfig(pluginsConfigFile())->group("Plugins");

        PluginLoader* loader = PluginLoader::instance();

        //Code borrowed from KWin
        foreach (const QString& pluginName, loader->getPluginList()) {
            QString enabledKey = pluginName + QString::fromLatin1("Enabled");

            bool isPluginEnabled = (pluginStates.hasKey(enabledKey) ? pluginStates.readEntry(enabledKey, false)
                                                            : loader->getPluginInfo(pluginName).isEnabledByDefault());

            if (isPluginEnabled) {
                KdeConnectPlugin* plugin = m_plugins.take(pluginName);
                QStringList incomingInterfaces, outgoingInterfaces;
                if (plugin) {
                    incomingInterfaces = m_pluginsByIncomingInterface.keys(plugin);
                    outgoingInterfaces = m_pluginsByOutgoingInterface.keys(plugin);
                } else {
                    const KPluginMetaData service = loader->getPluginInfo(pluginName);
                    incomingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-SupportedPackageType");
                    outgoingInterfaces = KPluginMetaData::readStringList(service.rawData(), "X-KdeConnect-OutgoingPackageType");
                }

                //If we don't find intersection with the received on one end and the sent on the other, we don't
                //let the plugin stay
                //Also, if no capabilities are specified on the other end, we don't apply this optimizaton, as
                //we assume that the other client doesn't know about capabilities.
                if (!m_incomingCapabilities.isEmpty() && !m_outgoingCapabilities.isEmpty()
                    && (m_incomingCapabilities & outgoingInterfaces.toSet()).isEmpty()
                    && (m_outgoingCapabilities & incomingInterfaces.toSet()).isEmpty()
                ) {
                    delete plugin;
                    continue;
                }

                if (!plugin) {
                    plugin = loader->instantiatePluginForDevice(pluginName, this);
                }

                foreach(const QString& interface, incomingInterfaces) {
                    newPluginsByIncomingInterface.insert(interface, plugin);
                }
                foreach(const QString& interface, outgoingInterfaces) {
                    newPluginsByOutgoingInterface.insert(interface, plugin);
                }
                newPluginMap[pluginName] = plugin;
            }
Example #12
0
void VarManager::search()
{
	setEnabled(false);

	QMultiMap<int, QString> vars = fieldArchive->searchAllVars();

	quint32 key;
	qint32 param;
	QTreeWidgetItem *item;
	QMap<int, bool> count;
	int lastVar=-1;

	QMapIterator<int, QString> i(vars);
	while(i.hasNext()) {
		i.next();
		if(lastVar == i.key())	continue;

		lastVar = i.key();
		JsmOpcode op(lastVar);
		key = op.key();
		param = op.param();
		count.insert(param, true);

		item = list->topLevelItem(param);
		item->setBackground(0, QColor(0xff,0xe5,0x99));

		if(key == 10 || key == 11 || key == 16) {
			item->setText(1, QString("%1Byte").arg(key == 16 ? "Signed " : ""));
		}
		else if(key == 12 || key == 13 || key == 17) {
			item->setText(1, QString("%1Word").arg(key == 17 ? "Signed " : ""));
			count.insert(param+1, true);
			list->topLevelItem(param+1)->setBackground(0, QColor(0xff,0xe5,0x99));
		}
		else if(key == 14 || key == 15 || key == 18) {
			item->setText(1, QString("%1Long").arg(key == 18 ? "Signed " : ""));
			count.insert(param+1, true);
			list->topLevelItem(param+1)->setBackground(0, QColor(0xff,0xe5,0x99));
			count.insert(param+2, true);
			list->topLevelItem(param+2)->setBackground(0, QColor(0xff,0xe5,0x99));
			count.insert(param+3, true);
			list->topLevelItem(param+3)->setBackground(0, QColor(0xff,0xe5,0x99));
		}
		QStringList fields(vars.values(lastVar));
		fields.append(item->text(3).split(", ", QString::SkipEmptyParts));
		fields.removeDuplicates();
		item->setText(3, fields.join(", "));
	}

	list->resizeColumnToContents(0);
	list->resizeColumnToContents(1);

	setEnabled(true);
	countLabel->setText(tr("Vars utilisés : %1/1536").arg(count.size()));
}
Example #13
0
QMultiMap<QString, ProjectConverter> ToolPluginManager::projectConverters() const
{
	QMultiMap<QString, ProjectConverter> result;
	for (ToolPluginInterface * const toolPlugin : mPlugins) {
		for (ProjectConverter const &converter : toolPlugin->projectConverters()) {
			result.insertMulti(converter.editor(), converter);
		}
	}

	return result;
}
/*!
    \internal

    Returns a lazily-initialized singleton. Ownership is granted to the
    QPlatformPrinterSupportPlugin, which is never unloaded or destroyed until
    application exit, i.e. you can expect this pointer to always be valid and
    multiple calls to this function will always return the same pointer.
*/
QPlatformPrinterSupport *QPlatformPrinterSupportPlugin::get()
{
    if (!printerSupport) {
        const QMultiMap<int, QString> keyMap = loader()->keyMap();
        if (!keyMap.isEmpty())
            printerSupport = qLoadPlugin<QPlatformPrinterSupport, QPlatformPrinterSupportPlugin>(loader(), keyMap.constBegin().value());
        if (printerSupport)
            qAddPostRoutine(cleanupPrinterSupport);
    }
    return printerSupport;
}
Example #15
0
QStringList Statistics::ranking(QString key){
    QMultiMap<quint64, QString> *map = this->_rankings.value(key);
    QStringList rankedList;
    QList<quint64> keys = map->keys();

    for(int i = keys.length()-1; i >= 0;--i){
        rankedList.append(map->value(keys.at(i)));
    }

    return rankedList;
}
Example #16
0
QString SDBCache::convertMapToString(QMultiMap<uint, uint> &map){
    QStringList tmp;

    QMultiMap<uint,uint>::iterator it = map.begin();
    while(it != map.end()){
        tmp.append(QString::number(it.key()));
        tmp.append(QString::number(it.value()));
        it++;
    }
    return tmp.join(",");
}
Example #17
0
QMultiMap < StationsPluginFactory *, StationsPlugin * >
StationsPluginManager::stations()
{
  QMultiMap < StationsPluginFactory *, StationsPlugin * > map;

  foreach (StationsPluginFactory *factory, factories.values())
    foreach (StationsPlugin *plugin, factory->plugins())
      map.insert(factory, plugin);

  return map;
}
void CircleLayout::layout()
{
	int total = vertexdraws.count();
	QPointF center = centerOf(vertexdraws);
	float radius = qMax(25.0, vertexdraws[0]->radius()*total/1.0);

	QMultiMap<double, VertexDraw*> sorteddraws;

	foreach(VertexDraw* draw, vertexdraws)
	{
		sorteddraws.insert(lineAngle(center, draw->pos()), draw);
	}
Example #19
0
void TranslationHandler::onMultipleGenerationFinished(bool ok)
{
    Request *req = m_pendingRequests.take(sender());
    if (ok && req) {
        QMultiMap<Type,QString> words;
        QWebElement table =
            req->webFrame()->findFirstElement("table");
        QWebElementCollection items = table.findAll("li");
        foreach (const QWebElement &item, items)
            words.insert(Any, item.toPlainText());
        emit generated(words);
    } else {
Example #20
0
void Transact::updateDestination()
{
	// TODO: should be a Qt model.
	ui->destination->clear();
	ui->destination->addItem("(Create Contract)");
	QMultiMap<QString, QString> in;
	for (Address const& a: m_main->allKnownAddresses())
		in.insert(QString::fromStdString(m_main->toName(a) + " (" + ICAP(a).encoded() + ")"), QString::fromStdString(a.hex()));
	for (auto i = in.begin(); i != in.end(); ++i)
		ui->destination->addItem(i.key(), i.value());

}
QMultiMap<int, IOptionsDialogWidget *> DataStreamsManger::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsDialogWidget *> widgets;
	if (FOptionsManager && ANodeId==OPN_DATATRANSFER)
	{
		int index = 0;
		foreach(IDataStreamMethod *method, FMethods)
		{
			widgets.insertMulti(OHO_DATATRANSFER_METHODNAME + index, FOptionsManager->newOptionsDialogHeader(tr("Transfer method %1").arg(method->methodName()),AParent));
			widgets.insertMulti(OWO_DATATRANSFER_METHODSETTINGS + index, method->methodSettingsWidget(settingsProfileNode(QUuid(),method->methodNS()),AParent));
			index += 10;
		}
Example #22
0
/*!
    Cleans the cache so that its size is under the maximum cache size.
    Returns the current size of the cache.

    When the current size of the cache is greater than the maximumCacheSize()
    older cache files are removed until the total size is less then 90% of
    maximumCacheSize() starting with the oldest ones first using the file
    creation date to determine how old a cache file is.

    Subclasses can reimplement this function to change the order that cache
    files are removed taking into account information in the application
    knows about that QNetworkDiskCache does not, for example the number of times
    a cache is accessed.

    Note: cacheSize() calls expire if the current cache size is unknown.

    \sa maximumCacheSize(), fileMetaData()
 */
qint64 QNetworkDiskCache::expire()
{
    Q_D(QNetworkDiskCache);
    if (d->currentCacheSize >= 0 && d->currentCacheSize < maximumCacheSize())
        return d->currentCacheSize;

    if (cacheDirectory().isEmpty()) {
        qWarning() << "QNetworkDiskCache::expire() The cache directory is not set";
        return 0;
    }

    // close file handle to prevent "in use" error when QFile::remove() is called
    d->lastItem.reset();

    QDir::Filters filters = QDir::AllDirs | QDir:: Files | QDir::NoDotAndDotDot;
    QDirIterator it(cacheDirectory(), filters, QDirIterator::Subdirectories);

    QMultiMap<QDateTime, QString> cacheItems;
    qint64 totalSize = 0;
    while (it.hasNext()) {
        QString path = it.next();
        QFileInfo info = it.fileInfo();
        QString fileName = info.fileName();
        if (fileName.endsWith(CACHE_POSTFIX)) {
            cacheItems.insert(info.created(), path);
            totalSize += info.size();
        }
    }

    int removedFiles = 0;
    qint64 goal = (maximumCacheSize() * 9) / 10;
    QMultiMap<QDateTime, QString>::const_iterator i = cacheItems.constBegin();
    while (i != cacheItems.constEnd()) {
        if (totalSize < goal)
            break;
        QString name = i.value();
        QFile file(name);
        qint64 size = file.size();
        file.remove();
        totalSize -= size;
        ++removedFiles;
        ++i;
    }
#if defined(QNETWORKDISKCACHE_DEBUG)
    if (removedFiles > 0) {
        qDebug() << "QNetworkDiskCache::expire()"
                << "Removed:" << removedFiles
                << "Kept:" << cacheItems.count() - removedFiles;
    }
#endif
    return totalSize;
}
QMultiMap<int, IOptionsWidget *> MainWindowPlugin::optionsWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsWidget *> widgets;
	if (FOptionsManager && ANodeId == OPN_ROSTER)
	{
		widgets.insertMulti(OWO_ROSTER_MAINWINDOW_STAYONTOP, FOptionsManager->optionsNodeWidget(Options::node(OPV_MAINWINDOW_STAYONTOP),tr("Stay on top of other windows"),AParent));
#ifdef Q_OS_WIN
		if (QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7)
			widgets.insertMulti(OWO_ROSTER_MAINWINDOW_MINIMIZETOTRAY, FOptionsManager->optionsNodeWidget(Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7),tr("Show application icon in tray"),AParent));
#endif
	}
	return widgets;
}
Example #24
0
void Annotations::updateDataHolder(const Jid &AStreamJid, const QList<Jid> &AContactJids)
{
	IRosterIndex *sroot = FRostersModel!=NULL ? FRostersModel->streamRoot(AStreamJid) : NULL;
	if (sroot && !AContactJids.isEmpty())
	{
		QMultiMap<int,QVariant> findData;
		foreach(const Jid &contactJid, AContactJids)
			findData.insertMulti(RDR_PREP_BARE_JID,contactJid.pBare());
		findData.insertMulti(RDR_STREAM_JID,AStreamJid.pFull());

		foreach (IRosterIndex *index, sroot->findChilds(findData,true))
			emit rosterDataChanged(index,RDR_ANNOTATIONS);
	}
Example #25
0
void ShareEngine::updatePlugins(const QStringList &changes)
{
    if (!changes.contains("services")) {
        return;
    }

    removeAllSources();

    KService::List services = KServiceTypeTrader::self()->query("Plasma/ShareProvider");
    QMultiMap<int, KService::Ptr> sortedServices;
    foreach (KService::Ptr service, services) {
        sortedServices.insert(service->property("X-KDE-Priority").toInt(), service);
    }
Example #26
0
QMultiMap<int, IOptionsDialogWidget *> UserTuneHandler::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsDialogWidget *> widgets;
	if (FOptionsManager && ANodeId == OPN_USERTUNE) {
#ifdef READ_WRITE_TUNE
		widgets.insertMulti(OWO_USERTUNE, new UserTuneOptions(AParent));
#else
		widgets.insertMulti(OWO_USERTUNE, FOptionsManager->optionsNodeWidget(Options::node(OPV_USERTUNE_SHOW_ROSTER_LABEL),tr("Show music icon in roster"),AParent));
		widgets.insertMulti(OWO_USERTUNE, FOptionsManager->optionsNodeWidget(Options::node(OPV_USERTUNE_TAG_FORMAT),tr("Tag format:"),AParent));
#endif
	}
	return widgets;
}
Example #27
0
bool PlanTableManager::is_excluded(const QMultiMap<QString, QString>& allowed_regions,
																		const format_reader::Record& record) const 
{
	const QString& current_code = record["CODE"];
	QString current_code_region = current_code.mid(0, 2);
	QMultiMap<QString, QString>::const_iterator it = allowed_regions.find(current_code_region);
	while (it != allowed_regions.end() && it.key() == current_code_region) {
     if (is_same_region(current_code, *it))
			 return false;
     ++it;
	}
	return true;
}
Example #28
0
void MERFTag::executeActions(NFA* nfa) {
    MSFormula* formula = (MSFormula*)(nfa->formula);

    /** pre match **/
    QString preMatch = msf->name;
    preMatch.append("_preMatch();\n");
    formula->actionData.append(preMatch);
    /** Done **/

    match->executeActions(nfa);

    /** on match **/
    QString onMatch = msf->name;
    onMatch.append("_onMatch");
    QMultiMap<QString,QPair<QString,QString> > *functionParametersMap = &(formula->functionParametersMap);
    QList<QPair<QString,QString> > params = functionParametersMap->values(onMatch);
    onMatch.append('(');

    for(int j=0; j<params.count(); j++) {
        QString msfName = params.at(j).first;
        QString field = params.at(j).second;

        QString sarfMatches;
        QString paramValue = getParam(msfName,field,&sarfMatches);
        if(field.compare("text") == 0) {
            onMatch.append('\"' + paramValue + "\",");
        }
        else if(field.compare("position") == 0) {
            onMatch.append(paramValue + ',');
        }
        else if(field.compare("length") == 0) {
            onMatch.append(paramValue + ',');
        }
        else if(field.compare("number") == 0) {
            onMatch.append(paramValue + ',');
        }
        else if(field.compare("matches") == 0) {
            onMatch.append(paramValue + ',');
            formula->actionData.append(sarfMatches);
        }
    }
    if(params.count() == 0) {
        onMatch.append(");\n");
    }
    else {
        onMatch.chop(1);
        onMatch.append(");\n");
    }
    formula->actionData.append(onMatch);
    /** Done **/
}
void PlaylistModel::sort(int column, Qt::SortOrder order)
{
    if (m_tracks.count() < 2)
    {
        return;
    }

    QMultiMap<QString, KUrl> keyMap;
    QMultiMap<qint64, KUrl> durationMap;
    KUrl::List tracks;
    const KUrl url = m_tracks.value(m_currentTrack);

    if (column == DurationColumn)
    {
        for (int i = 0; i < m_tracks.count(); ++i)
        {
            durationMap.insert(MetaDataManager::duration(m_tracks.at(i)), m_tracks.at(i));
        }

        tracks = durationMap.values();
    }
    else if (column > FileNameColumn && column < DurationColumn)
    {
        const MetaDataKey key = translateColumn(column);

        for (int i = 0; i < m_tracks.count(); ++i)
        {
            keyMap.insert(MetaDataManager::metaData(m_tracks.at(i), key), m_tracks.at(i));
        }

        tracks = keyMap.values();
    }
    else
    {
        for (int i = 0; i < m_tracks.count(); ++i)
        {
            keyMap.insert(m_tracks.at(i).pathOrUrl(), m_tracks.at(i));
        }

        tracks = keyMap.values();
    }

    if (order == Qt::AscendingOrder)
    {
        KUrl::List items;

        for (int i = (tracks.count() - 1); i >= 0; --i)
        {
            items.append(tracks.at(i));
        }

        tracks = items;
    }

    m_tracks = tracks;

    setCurrentTrack(findTrack(url));

    emit tracksChanged();
}
QMultiMap<int, IOptionsWidget *> OptionsManager::optionsWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsWidget *> widgets;
	if (ANodeId == OPN_COMMON)
	{
#ifndef Q_WS_MAC
		widgets.insertMulti(OWO_COMMON, optionsHeaderWidget(QString::null, tr("Common settings"), AParent));
#endif
#ifdef Q_WS_WIN
		widgets.insertMulti(OWO_COMMON_AUTOSTART, optionsNodeWidget(Options::node(OPV_MISC_AUTOSTART), tr("Launch application on system start up"), AParent));
#endif

#if defined(Q_WS_X11) || defined(DEBUG_ENABLED)
		if (CustomBorderStorage::isBordersAvail())
			widgets.insertMulti(OWO_COMMON_BORDERSENABLE, optionsNodeWidget(Options::node(OPV_MISC_CUSTOMBORDERSENABLED), tr("Enable windows customization (restart required)"), AParent));
#endif

#ifndef Q_WS_MAC
		widgets.insertMulti(OWO_COMMON_SINC, optionsHeaderWidget(QString::null, tr("Backing store your chat history and preferences"), AParent));
#endif
		widgets.insertMulti(OWO_COMMON_SINC_OPTIONS, optionsNodeWidget(Options::node(OPV_MISC_OPTIONS_SAVE_ON_SERVER), tr("Sync preferences on my several computers"), AParent));

		widgets.insertMulti(OWO_COMMON_LOCALE, optionsHeaderWidget(QString::null, tr("Interface language"), AParent));
		widgets.insertMulti(OWO_COMMON_LOCALE_SELECT, new LocaleOptionsWidget(AParent));
	}
	return widgets;
}