void KMSoundTestWidget::openSoundDialog( KURLRequester * ) { static bool init = true; if ( !init ) return; init = false; KFileDialog *fileDialog = m_urlRequester->fileDialog(); fileDialog->setCaption( i18n("Select Sound File") ); QStringList filters; filters << "audio/x-wav" << "audio/x-mp3" << "application/x-ogg" << "audio/x-adpcm"; fileDialog->setMimeFilter( filters ); QStringList soundDirs = KGlobal::dirs()->resourceDirs( "sound" ); if ( !soundDirs.isEmpty() ) { KURL soundURL; QDir dir; dir.setFilter( QDir::Files | QDir::Readable ); QStringList::ConstIterator it = soundDirs.begin(); while ( it != soundDirs.end() ) { dir = *it; if ( dir.isReadable() && dir.count() > 2 ) { soundURL.setPath( *it ); fileDialog->setURL( soundURL ); break; } ++it; } } }
void KstVectorDialogI::selectingFolder() { QString strFolder = _w->FileName->url(); KFileDialog *fileDlg = _w->FileName->fileDialog(); QFileInfo fileInfo(strFolder); if (fileDlg) { if (fileInfo.isDir()) { QDir dir(strFolder); if (dir.cdUp()) { fileDlg->setURL(KURL(dir.absPath())); } } } }