void TestLogging::systemLogs() { // check the active system log at boot QVariantMap params; params.insert("loggingSources", QVariantList() << JsonTypes::loggingSourceToString(Logging::LoggingSourceSystem)); params.insert("eventTypes", QVariantList() << JsonTypes::loggingEventTypeToString(Logging::LoggingEventTypeActiveChange)); // there should be 2 logs, one for shutdown, one for startup (from server restart) QVariant response = injectAndWait("Logging.GetLogEntries", params); verifyLoggingError(response); QVariantList logEntries = response.toMap().value("params").toMap().value("logEntries").toList(); QVERIFY(logEntries.count() == 2); QVariantMap logEntryShutdown = logEntries.first().toMap(); QCOMPARE(logEntryShutdown.value("active").toBool(), false); QCOMPARE(logEntryShutdown.value("eventType").toString(), JsonTypes::loggingEventTypeToString(Logging::LoggingEventTypeActiveChange)); QCOMPARE(logEntryShutdown.value("source").toString(), JsonTypes::loggingSourceToString(Logging::LoggingSourceSystem)); QCOMPARE(logEntryShutdown.value("loggingLevel").toString(), JsonTypes::loggingLevelToString(Logging::LoggingLevelInfo)); QVariantMap logEntryStartup = logEntries.last().toMap(); QCOMPARE(logEntryStartup.value("active").toBool(), true); QCOMPARE(logEntryStartup.value("eventType").toString(), JsonTypes::loggingEventTypeToString(Logging::LoggingEventTypeActiveChange)); QCOMPARE(logEntryStartup.value("source").toString(), JsonTypes::loggingSourceToString(Logging::LoggingSourceSystem)); QCOMPARE(logEntryStartup.value("loggingLevel").toString(), JsonTypes::loggingLevelToString(Logging::LoggingLevelInfo)); }
//If the data store changes this method updates the SceneCover with the latest push message void CoverManager::pushListUpdated() { QSettings settings; QVariantList pushList = settings.value("pushList").toList(); if (!pushList.isEmpty()) { //Read in the last message from the list QVariant lastReceivedPushMessageVariant = pushList.last(); QString lastReceivedPushMessage; QStringList messageParts; lastReceivedPushMessage = lastReceivedPushMessageVariant.toString(); qDebug() << "Last push received: " << lastReceivedPushMessage; messageParts = lastReceivedPushMessage.split('|'); if (messageParts.size() != 5) { qDebug() << "Invalid list length. Expected 5, received: " << messageParts.size(); } else { m_pushMessageCover->setProperty("priority", messageParts[0].toInt()); m_pushMessageCover->setProperty("title", messageParts[1]); m_pushMessageCover->setProperty("body", messageParts[2]); setDescription(messageParts[4]); } return; } else { //If the list is empty let's display some data to let the user know m_pushMessageCover->setProperty("priority", 13013); m_pushMessageCover->setProperty("title", ""); m_pushMessageCover->setProperty("body", ""); setDescription("-"); } }
void Ut_LipstickSettings::testSetLockScreenVisible() { LipstickSettings settings; // Externally making lock screen visible should not lock the screen settings.setLockscreenVisible(true, true); QCOMPARE(qDBusConnectionAsyncCallService.isEmpty(), true); settings.setLockscreenVisible(false, true); // Internally making lock screen visible should start the timer settings.setLockscreenVisible(true, false); QCOMPARE(qDBusConnectionAsyncCallService, QString("com.nokia.mce")); QCOMPARE(qDBusConnectionAsyncCallPath, QString("/com/nokia/mce/request")); QCOMPARE(qDBusConnectionAsyncCallInterface, QString("com.nokia.mce.request")); QCOMPARE(qDBusConnectionAsyncCallMember, QString("req_tklock_mode_change")); QCOMPARE(qDBusConnectionAsyncCallArguments.count(), 1); QCOMPARE(qDBusConnectionAsyncCallArguments.last(), QVariant(MCE_TK_LOCKED_DELAY)); // Reset the state qDBusConnectionAsyncCallService.clear(); // Externally making lock screen invisible should not lock the screen settings.setLockscreenVisible(false, true); QCOMPARE(qDBusConnectionAsyncCallService.isEmpty(), true); // Reset the state settings.setLockscreenVisible(true, false); qDBusConnectionAsyncCallService.clear(); // Internally making lock screen invisible should not lock the screen settings.setLockscreenVisible(false, false); QCOMPARE(qDBusConnectionAsyncCallService.isEmpty(), true); }
json::helper::helper_base* new_child() { type = LIST; QVariant tmp; list.push_back(tmp); return new qvariant_helper(list.last()); }
void QuotesApp::deleteRecord() { QVariantList indexPath = mListView->selected(); if (!indexPath.isEmpty()) { QVariantMap map = mDataModel->data(indexPath).toMap(); // Delete the item from the database based on unique ID. If successful, remove it // from the data model (which will remove the data from the list). if (mQuotesDbHelper->deleteById(map["id"])) { // Delete is the only operation where the logics for updating which item // is selected is handled in code. // Before the item is removed, we store how many items there are in the // category that the item is removed from, we need this to select a new item. QVariantList categoryIndexPath; categoryIndexPath.append(indexPath.first()); int childrenInCategory = mDataModel->childCount(categoryIndexPath); mDataModel->remove(map); // After removing the selected item, we want another quote to be shown. // So we select the next quote relative to the removed one in the list. if (childrenInCategory > 1) { // If the Category still has items, select within the category. int itemInCategory = indexPath.last().toInt(); if (itemInCategory < childrenInCategory - 1) { mListView->select(indexPath); } else { // The last item in the category was removed, select the previous item relative to the removed item. indexPath.replace(1, QVariant(itemInCategory - 1)); mListView->select(indexPath); } } else { // If no items left in the category, move to the next category. // If there are no more categories below(next), select the previous category. // If no items left at all, navigate to the list. QVariantList lastIndexPath = mDataModel->last(); if (!lastIndexPath.isEmpty()) { if (indexPath.first().toInt() <= lastIndexPath.first().toInt()) { mListView->select(indexPath); } else { mListView->select(mDataModel->last()); } } } // else statment } //if statement } // top if statement } // deleteRecord()
void RegroupNode::render( OutputStream *stream, Context *c ) const { Q_UNUSED( stream ) QVariantList objList = m_target.toList( c ); if ( objList.isEmpty() ) { c->insert( m_varName, QVariantHash() ); return; } // What's going on? // // objList is a flat list of objects with a common parameter. For example, Person objects with // a name parameter. The list is already sorted. // Say the objList contains ["David Beckham", "David Blain", "Keira Nightly"] etc. // We want to regroup the list into separate lists of people with the same first name. // ie objHash should be: {"David": ["David Beckham", "David Blain"], "Keira": ["Keira Nightly"]} // // We then insert the objHash into the Context ready for rendering later in a for loop. QVariantList contextList; const QString keyName = getSafeString( m_expression.resolve( c ) ); QListIterator<QVariant> i( objList ); while ( i.hasNext() ) { const QVariant var = i.next(); c->push(); c->insert( QLatin1String( "var" ), var ); const QString key = getSafeString( FilterExpression( QLatin1String( "var." ) + keyName, 0 ).resolve( c ) ); c->pop(); QVariantHash hash; if ( contextList.size() > 0 ) { QVariant hashVar = contextList.last(); hash = hashVar.toHash(); } if ( !hash.contains( QLatin1String( "grouper" ) ) || hash.value( QLatin1String( "grouper" ) ) != key ) { QVariantHash newHash; hash.insert( QLatin1String( "grouper" ), key ); hash.insert( QLatin1String( "list" ), QVariantList() ); contextList.append( newHash ); } QVariantList list = hash.value( QLatin1String( "list" ) ).toList(); list.append( var ); hash.insert( QLatin1String( "list" ), list ); contextList[contextList.size() - 1] = hash; } c->insert( m_varName, contextList ); }
TorrentSession::TorrentSession(): p_( new Private ) { QVariantList range = Settings::instance().get( "listen" ).toList(); this->p_->session.listen_on( std::make_pair( range.first().toInt(), range.last().toInt() ) ); this->p_->timer.start(); }