tools/assistant/lib/qhelpcollectionhandler.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
equal deleted inserted replaced
4:3b1da2848fc7 5:d3bac044e0f0
   250         "FilterAttributeId INTEGER )")
   250         "FilterAttributeId INTEGER )")
   251         << QLatin1String("CREATE TABLE SettingsTable ("
   251         << QLatin1String("CREATE TABLE SettingsTable ("
   252         "Key TEXT PRIMARY KEY, "
   252         "Key TEXT PRIMARY KEY, "
   253         "Value BLOB )");
   253         "Value BLOB )");
   254 
   254 
   255     foreach (QString q, tables) {
   255     foreach (const QString &q, tables) {
   256         if (!query->exec(q))
   256         if (!query->exec(q))
   257             return false;
   257             return false;
   258     }
   258     }
   259     return true;
   259     return true;
   260 }
   260 }
   321             m_query.value(0).toInt());
   321             m_query.value(0).toInt());
   322         if (idsToInsert.contains(m_query.value(1).toString()))
   322         if (idsToInsert.contains(m_query.value(1).toString()))
   323             idsToInsert.removeAll(m_query.value(1).toString());
   323             idsToInsert.removeAll(m_query.value(1).toString());
   324     }
   324     }
   325 
   325 
   326     foreach (QString id, idsToInsert) {
   326     foreach (const QString &id, idsToInsert) {
   327         m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)"));
   327         m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)"));
   328         m_query.bindValue(0, id);
   328         m_query.bindValue(0, id);
   329         m_query.exec();
   329         m_query.exec();
   330         attributeMap.insert(id, m_query.lastInsertId().toInt());
   330         attributeMap.insert(id, m_query.lastInsertId().toInt());
   331     }
   331     }
   344 
   344 
   345     m_query.prepare(QLatin1String("DELETE FROM FilterTable WHERE NameId=?"));
   345     m_query.prepare(QLatin1String("DELETE FROM FilterTable WHERE NameId=?"));
   346     m_query.bindValue(0, nameId);
   346     m_query.bindValue(0, nameId);
   347     m_query.exec();
   347     m_query.exec();
   348 
   348 
   349     foreach (QString att, attributes) {
   349     foreach (const QString &att, attributes) {
   350         m_query.prepare(QLatin1String("INSERT INTO FilterTable VALUES(?, ?)"));
   350         m_query.prepare(QLatin1String("INSERT INTO FilterTable VALUES(?, ?)"));
   351         m_query.bindValue(0, nameId);
   351         m_query.bindValue(0, nameId);
   352         m_query.bindValue(1, attributeMap[att]);
   352         m_query.bindValue(1, attributeMap[att]);
   353         if (!m_query.exec())
   353         if (!m_query.exec())
   354             return false;
   354             return false;
   398 
   398 
   399     if (!registerVirtualFolder(reader.virtualFolder(), nsId))
   399     if (!registerVirtualFolder(reader.virtualFolder(), nsId))
   400         return false;
   400         return false;
   401 
   401 
   402     addFilterAttributes(reader.filterAttributes());
   402     addFilterAttributes(reader.filterAttributes());
   403     foreach (QString filterName, reader.customFilters())
   403     foreach (const QString &filterName, reader.customFilters())
   404         addCustomFilter(filterName, reader.filterAttributes(filterName));
   404         addCustomFilter(filterName, reader.filterAttributes(filterName));
   405 
   405 
   406     optimizeDatabase(fileName);
   406     optimizeDatabase(fileName);
   407 
   407 
   408     return true;
   408     return true;
   497     m_query.exec(QLatin1String("SELECT Name FROM FilterAttributeTable"));
   497     m_query.exec(QLatin1String("SELECT Name FROM FilterAttributeTable"));
   498     QSet<QString> atts;
   498     QSet<QString> atts;
   499     while (m_query.next())
   499     while (m_query.next())
   500         atts.insert(m_query.value(0).toString());
   500         atts.insert(m_query.value(0).toString());
   501 
   501 
   502     foreach (QString s, attributes) {
   502     foreach (const QString &s, attributes) {
   503         if (!atts.contains(s)) {
   503         if (!atts.contains(s)) {
   504             m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)"));
   504             m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)"));
   505             m_query.bindValue(0, s);
   505             m_query.bindValue(0, s);
   506             m_query.exec();
   506             m_query.exec();
   507         }
   507         }