bool GroupPad::onEvent(const Event &ev) { if(ev.type == Event::element_selected && m_filter_box.get() == ev.source) m_editor->setTileFilter(currentFilter()); else return false; return true; }
void MediaLibrary::filterUpdated( const QString &filter ) { const MediaListView::MediaList &medias = m_mediaListView->mediaList(); MediaListView::MediaList::const_iterator it = medias.begin(); MediaListView::MediaList::const_iterator ite = medias.end(); while ( it != ite ) { MediaCellView *mcv = it.value(); mcv->setVisible( currentFilter()( mcv->clip(), filter ) ); ++it; } }
int QHelpEngineCore::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 4) qt_static_metacall(this, _c, _id, _a); _id -= 4; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = autoSaveFilter(); break; case 1: *reinterpret_cast< QString*>(_v) = collectionFile(); break; case 2: *reinterpret_cast< QString*>(_v) = currentFilter(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setAutoSaveFilter(*reinterpret_cast< bool*>(_v)); break; case 1: setCollectionFile(*reinterpret_cast< QString*>(_v)); break; case 2: setCurrentFilter(*reinterpret_cast< QString*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
bool KexiFileWidget::checkSelectedFile() { kDebug() << "d->highlightedUrl: " << d->highlightedUrl; if (!locationEdit()->lineEdit()->text().isEmpty()) { kDebug() << locationEdit()->lineEdit()->text(); //kDebug() << locationEdit()->urls(); kDebug() << baseUrl(); d->highlightedUrl = baseUrl(); const QString firstUrl(locationEdit()->lineEdit()->text()); // FIXME: find first... if (QDir::isAbsolutePath(firstUrl)) d->highlightedUrl = KUrl::fromPath(firstUrl); else d->highlightedUrl.addPath(firstUrl); } kDebug() << "d->highlightedUrl: " << d->highlightedUrl; if (d->highlightedUrl.isEmpty()) { KMessageBox::error(this, i18n("Enter a filename.")); return false; } if (!currentFilter().isEmpty()) { if (d->mode & SavingFileBasedDB) { const QStringList filters( currentFilter().split(' ') ); QString path = highlightedFile(); kDebug()<< "filter:" << filters << "path:" << path; QString ext( QFileInfo(path).suffix() ); bool hasExtension = false; foreach (const QString& filter, filters) { const QString f( filter.trimmed() ); hasExtension = !f.mid(2).isEmpty() && ext==f.mid(2); if (hasExtension) break; } if (!hasExtension) { //no extension: add one QString defaultExtension( d->defaultExtension ); if (defaultExtension.isEmpty()) { defaultExtension = filters.first().trimmed().mid(2); //first one } path += (QLatin1String(".")+defaultExtension); kDebug() << "appended extension" << path; setSelection( path ); d->highlightedUrl = KUrl(path); } } } kDebug() << "KexiFileWidget::checkURL() path: " << d->highlightedUrl; // kDebug() << "KexiFileWidget::checkURL() fname: " << url.fileName(); //! @todo if ( url.isLocalFile() ) { QFileInfo fi(d->highlightedUrl.toLocalFile()); if (mode() & KFile::ExistingOnly) { if (!fi.exists()) { KMessageBox::error(this, "<qt>" + i18n("The file \"%1\" does not exist.", QDir::convertSeparators(d->highlightedUrl.toLocalFile()))); return false; } else if (mode() & KFile::File) { if (!fi.isFile()) { KMessageBox::error(this, "<qt>" + i18n("Enter a filename.")); return false; } else if (!fi.isReadable()) { KMessageBox::error(this, "<qt>" + i18n("The file \"%1\" is not readable.", QDir::convertSeparators(d->highlightedUrl.path()))); return false; } } } else if (d->confirmOverwrites && !askForOverwriting(d->highlightedUrl.path(), this)) { return false; } return true; }