author | zecke <zecke> | 2004-06-29 20:04:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-06-29 20:04:17 (UTC) |
commit | c4405f8d22769e9881484d3f7640e4ba87ed75ee (patch) (unidiff) | |
tree | af997b01742c9b7762babca007edf1310c455289 | |
parent | 8bd9d5e9416166a1bb9a3f455ebf73a14628c628 (diff) | |
download | opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.zip opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.tar.gz opie-c4405f8d22769e9881484d3f7640e4ba87ed75ee.tar.bz2 |
As pointed out by bradc OpiePlayer2 is not able to open desktop files.
Now we check if it is a valid desktop file and then ask for the DocLnk::file()
and then use that for open.
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 6a15134..36f77be 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -282,99 +282,105 @@ void PlayListWidget::addAllToList() { | |||
282 | 282 | ||
283 | tabWidget->setCurrentPage(0); | 283 | tabWidget->setCurrentPage(0); |
284 | 284 | ||
285 | writeCurrentM3u(); | 285 | writeCurrentM3u(); |
286 | d->selectedFiles->first(); | 286 | d->selectedFiles->first(); |
287 | } | 287 | } |
288 | 288 | ||
289 | 289 | ||
290 | void PlayListWidget::addAllMusicToList() { | 290 | void PlayListWidget::addAllMusicToList() { |
291 | 291 | ||
292 | audioView->populateView(); | 292 | audioView->populateView(); |
293 | 293 | ||
294 | QListViewItemIterator audioIt( audioView ); | 294 | QListViewItemIterator audioIt( audioView ); |
295 | DocLnk lnk; | 295 | DocLnk lnk; |
296 | QString filename; | 296 | QString filename; |
297 | // iterate through all items of the listview | 297 | // iterate through all items of the listview |
298 | for ( ; audioIt.current(); ++audioIt ) { | 298 | for ( ; audioIt.current(); ++audioIt ) { |
299 | filename = audioIt.current()->text(3); | 299 | filename = audioIt.current()->text(3); |
300 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 300 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
301 | lnk.setFile( filename ); //sets file name | 301 | lnk.setFile( filename ); //sets file name |
302 | d->selectedFiles->addToSelection( lnk); | 302 | d->selectedFiles->addToSelection( lnk); |
303 | } | 303 | } |
304 | 304 | ||
305 | tabWidget->setCurrentPage(0); | 305 | tabWidget->setCurrentPage(0); |
306 | writeCurrentM3u(); | 306 | writeCurrentM3u(); |
307 | d->selectedFiles->first(); | 307 | d->selectedFiles->first(); |
308 | } | 308 | } |
309 | 309 | ||
310 | 310 | ||
311 | void PlayListWidget::addAllVideoToList() { | 311 | void PlayListWidget::addAllVideoToList() { |
312 | 312 | ||
313 | videoView->populateView(); | 313 | videoView->populateView(); |
314 | 314 | ||
315 | QListViewItemIterator videoIt( videoView ); | 315 | QListViewItemIterator videoIt( videoView ); |
316 | DocLnk lnk; | 316 | DocLnk lnk; |
317 | QString filename; | 317 | QString filename; |
318 | for ( ; videoIt.current(); ++videoIt ) { | 318 | for ( ; videoIt.current(); ++videoIt ) { |
319 | filename = videoIt.current()->text(3); | 319 | filename = videoIt.current()->text(3); |
320 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 320 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
321 | lnk.setFile( filename ); //sets file name | 321 | lnk.setFile( filename ); //sets file name |
322 | d->selectedFiles->addToSelection( lnk); | 322 | d->selectedFiles->addToSelection( lnk); |
323 | } | 323 | } |
324 | tabWidget->setCurrentPage(0); | 324 | tabWidget->setCurrentPage(0); |
325 | writeCurrentM3u(); | 325 | writeCurrentM3u(); |
326 | d->selectedFiles->first(); | 326 | d->selectedFiles->first(); |
327 | } | 327 | } |
328 | 328 | ||
329 | 329 | ||
330 | void PlayListWidget::setDocument( const QString& fileref ) { | 330 | void PlayListWidget::setDocument( const QString& _fileref ) { |
331 | // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; | 331 | // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl; |
332 | QString fileref = _fileref; | ||
332 | fromSetDocument = TRUE; | 333 | fromSetDocument = TRUE; |
334 | |||
335 | DocLnk lnk(_fileref); | ||
336 | if(lnk.isValid()) | ||
337 | fileref = lnk.file(); | ||
338 | |||
333 | QFileInfo fileInfo(fileref); | 339 | QFileInfo fileInfo(fileref); |
334 | 340 | ||
335 | if ( !fileInfo.exists() ) { | 341 | if ( !fileInfo.exists() ) { |
336 | QMessageBox::warning( this, tr( "Invalid File" ), | 342 | QMessageBox::warning( this, tr( "Invalid File" ), |
337 | tr( "There was a problem in getting the file." ) ); | 343 | tr( "There was a problem in getting the file." ) ); |
338 | return; | 344 | return; |
339 | } | 345 | } |
340 | 346 | ||
341 | clearList(); | 347 | clearList(); |
342 | QString extension = fileInfo.extension(false); | 348 | QString extension = fileInfo.extension(false); |
343 | 349 | ||
344 | if( extension.find( "m3u", 0, false) != -1 | 350 | if( extension.find( "m3u", 0, false) != -1 |
345 | || extension.find( "pls", 0, false) != -1 ) { | 351 | || extension.find( "pls", 0, false) != -1 ) { |
346 | readListFromFile( fileref ); | 352 | readListFromFile( fileref ); |
347 | } else { | 353 | } else { |
348 | clearList(); | 354 | clearList(); |
349 | DocLnk lnk; | 355 | DocLnk lnk; |
350 | lnk.setName( fileInfo.baseName() ); //sets name | 356 | lnk.setName( fileInfo.baseName() ); //sets name |
351 | lnk.setFile( fileref ); //sets file name | 357 | lnk.setFile( fileref ); //sets file name |
352 | addToSelection( lnk ); | 358 | addToSelection( lnk ); |
353 | writeCurrentM3u(); | 359 | writeCurrentM3u(); |
354 | 360 | ||
355 | d->setDocumentUsed = TRUE; | 361 | d->setDocumentUsed = TRUE; |
356 | mediaPlayerState->setPlaying( FALSE ); | 362 | mediaPlayerState->setPlaying( FALSE ); |
357 | mediaPlayerState->setPlaying( TRUE ); | 363 | mediaPlayerState->setPlaying( TRUE ); |
358 | } | 364 | } |
359 | } | 365 | } |
360 | 366 | ||
361 | 367 | ||
362 | void PlayListWidget::useSelectedDocument() { | 368 | void PlayListWidget::useSelectedDocument() { |
363 | d->setDocumentUsed = FALSE; | 369 | d->setDocumentUsed = FALSE; |
364 | } | 370 | } |
365 | 371 | ||
366 | 372 | ||
367 | const DocLnk *PlayListWidget::current() const { // this is fugly | 373 | const DocLnk *PlayListWidget::current() const { // this is fugly |
368 | assert( currentTab() == CurrentPlayList ); | 374 | assert( currentTab() == CurrentPlayList ); |
369 | 375 | ||
370 | const DocLnk *lnk = d->selectedFiles->current(); | 376 | const DocLnk *lnk = d->selectedFiles->current(); |
371 | if ( !lnk ) { | 377 | if ( !lnk ) { |
372 | d->selectedFiles->first(); | 378 | d->selectedFiles->first(); |
373 | lnk = d->selectedFiles->current(); | 379 | lnk = d->selectedFiles->current(); |
374 | } | 380 | } |
375 | assert( lnk ); | 381 | assert( lnk ); |
376 | return lnk; | 382 | return lnk; |
377 | } | 383 | } |
378 | 384 | ||
379 | 385 | ||
380 | bool PlayListWidget::prev() { | 386 | bool PlayListWidget::prev() { |