Exemple #1
0
void HistoryManager::removeOldEntries(const QDateTime &date)
{
	int timestamp = (date.isValid() ? date.toTime_t() : 0);

	if (timestamp == 0)
	{
		QSqlQuery query(QSqlDatabase::database(QLatin1String("browsingHistory")));
		query.prepare(QStringLiteral("SELECT \"visits\".\"time\" FROM \"visits\" ORDER BY \"visits\".\"time\" DESC LIMIT %1, 1;").arg(SettingsManager::getValue(QLatin1String("History/BrowsingLimitAmountGlobal")).toInt()));
		query.exec();

		if (query.next())
		{
			timestamp = query.record().field(QLatin1String("time")).value().toInt();
		}

		if (timestamp == 0)
		{
			return;
		}
	}

	QList<qint64> entries;
	QSqlQuery query(QSqlDatabase::database(QLatin1String("browsingHistory")));
	query.prepare(QLatin1String("SELECT \"visits\".\"id\" FROM \"visits\" WHERE \"visits\".\"time\" <= ?;"));
	query.bindValue(0, timestamp);
	query.exec();

	while (query.next())
	{
		entries.append(query.record().field("id").value().toLongLong());
	}

	removeEntries(entries);
}
void OsmAnd::MapRendererTiledResourcesCollection::removeResources(const ResourceFilterCallback filter)
{
    removeEntries(
        [filter]
        (const std::shared_ptr<MapRendererBaseTiledResource>& entry, bool& cancel) -> bool
        {
            return filter(entry, cancel);
        });
}
Exemple #3
0
		void SAP::remove(GIMBLE_HANDLE o)
		{
			SAPObject *obj = mObjects[o];

			mObjects[o] = 0;
			if (o < mFirstFreeObjectIndex) mFirstFreeObjectIndex = o;

			removeEntries(obj);
			mNumObjects--;
			delete obj;
		}
void HistoryMessagesTab::createGui()
{
	TimelinePopupMenu = new QMenu(this);
	TimelinePopupMenu->addAction(KaduIcon("kadu_icons/clear-history").icon(), tr("&Remove entries"),
	                             this, SLOT(removeEntries()));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(2);

	Splitter = new QSplitter(Qt::Horizontal, this);

	FilteredView = new FilteredTreeView(FilteredTreeView::FilterAtTop, Splitter);
	FilteredView->filterWidget()->setAutoVisibility(false);
	FilteredView->filterWidget()->setLabel(tr("Filter") + ":");

	TalkableTree = new TalkableTreeView(FilteredView);
	TalkableTree->setAlternatingRowColors(true);
	TalkableTree->setContextMenuEnabled(true);
	TalkableTree->setContextMenuPolicy(Qt::CustomContextMenu);
	TalkableTree->setUseConfigurationColors(true);
	TalkableTree->delegateConfiguration().setShowMessagePixmap(false);

	QString style;
	style.append("QTreeView::branch:has-siblings:!adjoins-item { border-image: none; image: none }");
	style.append("QTreeView::branch:has-siblings:adjoins-item { border-image: none; image: none }");
	style.append("QTreeView::branch:has-childres:!has-siblings:adjoins-item { border-image: none; image: none }");
	TalkableTree->setStyleSheet(style);
	TalkableTree->viewport()->setStyleSheet(style);

	connect(TalkableTree, SIGNAL(currentChanged(Talkable)), this, SLOT(currentTalkableChanged(Talkable)));
	connect(TalkableTree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showTalkablePopupMenu()));

	FilteredView->setView(TalkableTree);

	TimelineView = new TimelineChatMessagesView(Splitter);
	TimelineView->searchBar()->setAutoVisibility(false);
	TimelineView->searchBar()->setSearchWidget(this);
	TimelineView->timeline()->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(TimelineView->timeline(), SIGNAL(customContextMenuRequested(QPoint)),
	        this, SLOT(showTimelinePopupMenu()));
	connect(timelineView(), SIGNAL(currentDateChanged()), this, SLOT(currentDateChanged()));

	QList<int> sizes;
	sizes.append(150);
	sizes.append(300);
	Splitter->setSizes(sizes);

	layout->addWidget(Splitter);

	setFocusProxy(FilteredView->filterWidget());
}
void
AccountListWidget::updateEntries( const QModelIndex& topLeft, const QModelIndex& bottomRight )
{
    for( int row = topLeft.row(); row <= bottomRight.row(); ++row )
    {
        QPersistentModelIndex idx( m_model->index( row, 0 ) );

        int newCount = idx.data( Tomahawk::Accounts::AccountModel::ChildrenOfFactoryRole )
                            .value< QList< Tomahawk::Accounts::Account* > >().count();

        if( m_entries.value( idx ).count() == newCount )
        {
            updateEntry( idx );
        }
        else
        {
            removeEntries( idx.parent(), idx.row(), idx.row() );
            insertEntries( idx.parent(), idx.row(), idx.row() );
        }
    }
}
void QuillMetadata::removeEntries(TagGroup tagGroup)
{
    removeEntries(QuillMetadataPrivate::m_tagGroups.value(tagGroup));
    priv->exif->removeEntries(tagGroup);
}