summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-09-01 14:50:06 (UTC)
committer llornkcor <llornkcor>2002-09-01 14:50:06 (UTC)
commit4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7 (patch) (unidiff)
tree4371833546bed60c7e4d48db8527781c57533bec
parent2dab5b4aa31d795e968f81eb053ab507d96ff541 (diff)
downloadopie-4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7.zip
opie-4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7.tar.gz
opie-4602b00b2d76fca5c9ab86a589192f6bdb1e7ee7.tar.bz2
fix for bug 0000014
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp10
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp11
3 files changed, 15 insertions, 8 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 0ced256..c54a00f 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -472,162 +472,162 @@ void LauncherView::setToolsEnabled(bool y)
472 catmb->setFixedHeight ( 20 ); 472 catmb->setFixedHeight ( 20 );
473 473
474 updateTools(); 474 updateTools();
475 tools->show(); 475 tools->show();
476 } else { 476 } else {
477 delete tools; 477 delete tools;
478 tools = 0; 478 tools = 0;
479 } 479 }
480 } 480 }
481} 481}
482 482
483void LauncherView::updateTools() 483void LauncherView::updateTools()
484{ 484{
485 disconnect( typemb, SIGNAL(selected(const QString&)), 485 disconnect( typemb, SIGNAL(selected(const QString&)),
486 this, SLOT(showType(const QString&)) ); 486 this, SLOT(showType(const QString&)) );
487 disconnect( catmb, SIGNAL(signalSelected(int)), 487 disconnect( catmb, SIGNAL(signalSelected(int)),
488 this, SLOT(showCategory(int)) ); 488 this, SLOT(showCategory(int)) );
489 489
490 icons->updateCategoriesAndMimeTypes(); 490 icons->updateCategoriesAndMimeTypes();
491 491
492 QString prev; 492 QString prev;
493 493
494 // Type filter 494 // Type filter
495 QStringList types; 495 QStringList types;
496 types << tr("All"); 496 types << tr("All");
497 types << "--"; 497 types << "--";
498 types += icons->mimeTypes(); 498 types += icons->mimeTypes();
499 prev = typemb->currentText(); 499 prev = typemb->currentText();
500 typemb->clear(); 500 typemb->clear();
501 typemb->insertItems(types); 501 typemb->insertItems(types);
502 typemb->select(prev); 502 typemb->select(prev);
503 503
504 Categories cats( 0 ); 504 Categories cats( 0 );
505 cats.load( categoryFileName() ); 505 cats.load( categoryFileName() );
506 QArray<int> vl( 0 ); 506 QArray<int> vl( 0 );
507 catmb->setCategories( vl, "Document View", tr("Document View") ); 507 catmb->setCategories( vl, "Document View", tr("Document View") );
508 catmb->setRemoveCategoryEdit( TRUE ); 508 catmb->setRemoveCategoryEdit( TRUE );
509 catmb->setAllCategories( TRUE ); 509 catmb->setAllCategories( TRUE );
510 510
511 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); 511 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
512 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); 512 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
513} 513}
514 514
515void LauncherView::sortBy(int s) 515void LauncherView::sortBy(int s)
516{ 516{
517 icons->setSortMethod((LauncherIconView::SortMethod)s); 517 icons->setSortMethod((LauncherIconView::SortMethod)s);
518} 518}
519 519
520void LauncherView::showType(const QString& t) 520void LauncherView::showType(const QString& t)
521{ 521{
522 if ( t == tr("All") ) { 522 if ( t == tr("All") ) {
523 icons->setTypeFilter("",TRUE); 523 icons->setTypeFilter("",TRUE);
524 } else { 524 } else {
525 icons->setTypeFilter(t+"/*",TRUE); 525 icons->setTypeFilter(t+"/*",TRUE);
526 } 526 }
527} 527}
528 528
529void LauncherView::showCategory( int c ) 529void LauncherView::showCategory( int c )
530{ 530{
531 icons->setCategoryFilter( c, TRUE ); 531 icons->setCategoryFilter( c, TRUE );
532} 532}
533 533
534void LauncherView::resizeEvent(QResizeEvent *e) 534void LauncherView::resizeEvent(QResizeEvent *e)
535{ 535{
536 QVBox::resizeEvent( e ); 536 QVBox::resizeEvent( e );
537 if ( e->size().width() != e->oldSize().width() ) 537 if ( e->size().width() != e->oldSize().width() )
538 sort(); 538 sort();
539} 539}
540 540
541void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) 541void LauncherView::populate( AppLnkSet *folder, const QString& typefilter )
542{ 542{
543 icons->clear(); 543 icons->clear();
544 internalPopulate( folder, typefilter ); 544 internalPopulate( folder, typefilter );
545} 545}
546 546
547void LauncherView::selectionChanged() 547void LauncherView::selectionChanged()
548{ 548{
549 QIconViewItem* item = icons->currentItem(); 549 QIconViewItem* item = icons->currentItem();
550 if ( item && item->isSelected() ) { 550 if ( item && item->isSelected() ) {
551 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 551 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
552 if ( icons->inKeyEvent() ) // not for mouse press 552 if ( icons->inKeyEvent() ) // not for mouse press
553 emit clicked( appLnk ); 553 emit clicked( appLnk );
554 item->setSelected(FALSE); 554 item->setSelected(FALSE);
555 } 555 }
556} 556}
557 557
558void LauncherView::returnPressed( QIconViewItem *item ) 558void LauncherView::returnPressed( QIconViewItem *item )
559{ 559{
560 if ( item ) { 560 if ( item ) {
561 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 561 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
562 emit clicked( appLnk ); 562 emit clicked( appLnk );
563 } 563 }
564} 564}
565 565
566void LauncherView::itemClicked( int btn, QIconViewItem *item ) 566void LauncherView::itemClicked( int btn, QIconViewItem *item )
567{ 567{
568 if ( item ) { 568 if ( item ) {
569 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 569 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
570 if ( btn == LeftButton ) { 570 if ( btn == LeftButton ) {
571 // Make sure it's the item we execute that gets highlighted 571 // Make sure it's the item we execute that gets highlighted
572 icons->setCurrentItem( item ); 572 icons->setCurrentItem( item );
573 emit clicked( appLnk ); 573 emit clicked( appLnk );
574 } 574 }
575 item->setSelected(FALSE); 575 item->setSelected(FALSE);
576 } 576 }
577} 577}
578 578
579void LauncherView::itemPressed( int btn, QIconViewItem *item ) 579void LauncherView::itemPressed( int btn, QIconViewItem *item )
580{ 580{
581 if ( item ) { 581 if ( item ) {
582 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 582 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
583 if ( btn == RightButton ) 583 if ( btn == RightButton )
584 emit rightPressed( appLnk ); 584 emit rightPressed( appLnk );
585/* 585/*
586 else if ( btn == LeftButton ) 586 else if ( btn == LeftButton )
587 emit clicked( appLnk ); 587 emit clicked( appLnk );
588*/ 588*/
589 item->setSelected(FALSE); 589 item->setSelected(FALSE);
590 } 590 }
591} 591}
592 592
593void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) 593void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter )
594{ 594{
595 QListIterator<AppLnk> it( folder->children() ); 595 QListIterator<AppLnk> it( folder->children() );
596 icons->setTypeFilter(typefilter,FALSE); 596 icons->setTypeFilter(typefilter,FALSE);
597 597
598 while ( it.current() ) { 598 while ( it.current() ) {
599 // show only the icons for existing files 599 // show only the icons for existing files
600 if (!QFile(it.current()->file()).exists() ) 600 if (!QFile(it.current()->file()).exists() & it.current()->file().left(4) != "http")
601 { 601 {
602 //maybe insert some .desktop file deletion code later 602 //maybe insert some .desktop file deletion code later
603 //maybe dir specific 603 //maybe dir specific
604 } 604 }
605 else 605 else
606 { 606 {
607 icons->addItem(*it,FALSE); 607 icons->addItem(*it,FALSE);
608 } 608 }
609 ++it; 609 ++it;
610 } 610 }
611 611
612 icons->sort(); 612 icons->sort();
613} 613}
614 614
615bool LauncherView::removeLink(const QString& linkfile) 615bool LauncherView::removeLink(const QString& linkfile)
616{ 616{
617 return icons->removeLink(linkfile); 617 return icons->removeLink(linkfile);
618} 618}
619 619
620void LauncherView::sort() 620void LauncherView::sort()
621{ 621{
622 icons->sort(); 622 icons->sort();
623} 623}
624 624
625void LauncherView::addItem(AppLnk* app, bool resort) 625void LauncherView::addItem(AppLnk* app, bool resort)
626{ 626{
627 icons->addItem(app,resort); 627 icons->addItem(app,resort);
628} 628}
629 629
630void LauncherView::setFileSystems(const QList<FileSystem> &) 630void LauncherView::setFileSystems(const QList<FileSystem> &)
631{ 631{
632 // ### does nothing now... 632 // ### does nothing now...
633} 633}
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 65dc5fb..8d66407 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -905,260 +905,264 @@ void PlayListWidget::deletePlaylist() {
905void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 905void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
906{ 906{
907 switch (mouse) { 907 switch (mouse) {
908 case 1: 908 case 1:
909 break; 909 break;
910 case 2:{ 910 case 2:{
911 911
912 QPopupMenu m; 912 QPopupMenu m;
913 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 913 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
914 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 914 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
915 m.insertSeparator(); 915 m.insertSeparator();
916 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) 916 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
917 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 917 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
918 918
919 m.exec( QCursor::pos() ); 919 m.exec( QCursor::pos() );
920 } 920 }
921 break; 921 break;
922 }; 922 };
923} 923}
924 924
925void PlayListWidget::playSelected() 925void PlayListWidget::playSelected()
926{ 926{
927 btnPlay( TRUE); 927 btnPlay( TRUE);
928// d->selectedFiles->unSelect(); 928// d->selectedFiles->unSelect();
929} 929}
930 930
931void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 931void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
932{ 932{
933 switch (mouse) { 933 switch (mouse) {
934 case 1: 934 case 1:
935 935
936 break; 936 break;
937 case 2:{ 937 case 2:{
938 QPopupMenu m; 938 QPopupMenu m;
939 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 939 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
940 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 940 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
941// m.insertSeparator(); 941// m.insertSeparator();
942// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 942// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
943 m.exec( QCursor::pos() ); 943 m.exec( QCursor::pos() );
944 } 944 }
945 break; 945 break;
946 }; 946 };
947 947
948} 948}
949 949
950void PlayListWidget::listDelete() { 950void PlayListWidget::listDelete() {
951 Config cfg( "OpiePlayer" ); 951 Config cfg( "OpiePlayer" );
952 cfg.setGroup("PlayList"); 952 cfg.setGroup("PlayList");
953 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 953 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
954 QString file; 954 QString file;
955 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 955 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
956 switch ( tabWidget->currentPageIndex()) { 956 switch ( tabWidget->currentPageIndex()) {
957 case 0: 957 case 0:
958 break; 958 break;
959 case 1: 959 case 1:
960 { 960 {
961 file = audioView->currentItem()->text(0); 961 file = audioView->currentItem()->text(0);
962 QListIterator<DocLnk> Pdit( files.children() ); 962 QListIterator<DocLnk> Pdit( files.children() );
963 for ( ; Pdit.current(); ++Pdit ) { 963 for ( ; Pdit.current(); ++Pdit ) {
964 if( Pdit.current()->name() == file) { 964 if( Pdit.current()->name() == file) {
965 LnkProperties prop( Pdit.current() ); 965 LnkProperties prop( Pdit.current() );
966 prop.showMaximized(); 966 prop.showMaximized();
967 prop.exec(); 967 prop.exec();
968 } 968 }
969 } 969 }
970 populateAudioView(); 970 populateAudioView();
971 } 971 }
972 break; 972 break;
973 case 2: 973 case 2:
974 { 974 {
975// file = videoView->selectedItem()->text(0); 975// file = videoView->selectedItem()->text(0);
976// for ( int i = 0; i < noOfFiles; i++ ) { 976// for ( int i = 0; i < noOfFiles; i++ ) {
977// QString entryName; 977// QString entryName;
978// entryName.sprintf( "File%i", i + 1 ); 978// entryName.sprintf( "File%i", i + 1 );
979// QString linkFile = cfg.readEntry( entryName ); 979// QString linkFile = cfg.readEntry( entryName );
980// AppLnk lnk( AppLnk(linkFile)); 980// AppLnk lnk( AppLnk(linkFile));
981// if( lnk.name() == file ) { 981// if( lnk.name() == file ) {
982// LnkProperties prop( &lnk); 982// LnkProperties prop( &lnk);
983// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 983// // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
984// prop.showMaximized(); 984// prop.showMaximized();
985// prop.exec(); 985// prop.exec();
986// } 986// }
987// } 987// }
988 } 988 }
989 break; 989 break;
990 }; 990 };
991} 991}
992 992
993void PlayListWidget::scanForAudio() { 993void PlayListWidget::scanForAudio() {
994 qDebug("scan for audio"); 994 qDebug("scan for audio");
995 files.detachChildren(); 995 files.detachChildren();
996 QListIterator<DocLnk> sdit( files.children() ); 996 QListIterator<DocLnk> sdit( files.children() );
997 for ( ; sdit.current(); ++sdit ) { 997 for ( ; sdit.current(); ++sdit ) {
998 delete sdit.current(); 998 delete sdit.current();
999 } 999 }
1000 Global::findDocuments(&files, "audio/*"); 1000 Global::findDocuments(&files, "audio/*");
1001 audioScan = TRUE; 1001 audioScan = TRUE;
1002} 1002}
1003void PlayListWidget::scanForVideo() { 1003void PlayListWidget::scanForVideo() {
1004 qDebug("scan for video"); 1004 qDebug("scan for video");
1005 vFiles.detachChildren(); 1005 vFiles.detachChildren();
1006 QListIterator<DocLnk> sdit( vFiles.children() ); 1006 QListIterator<DocLnk> sdit( vFiles.children() );
1007 for ( ; sdit.current(); ++sdit ) { 1007 for ( ; sdit.current(); ++sdit ) {
1008 delete sdit.current(); 1008 delete sdit.current();
1009 } 1009 }
1010 Global::findDocuments(&vFiles, "video/*"); 1010 Global::findDocuments(&vFiles, "video/*");
1011 videoScan = TRUE; 1011 videoScan = TRUE;
1012} 1012}
1013 1013
1014void PlayListWidget::populateAudioView() { 1014void PlayListWidget::populateAudioView() {
1015 1015
1016 audioView->clear(); 1016 audioView->clear();
1017 StorageInfo storageInfo; 1017 StorageInfo storageInfo;
1018 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1018 const QList<FileSystem> &fs = storageInfo.fileSystems();
1019 if(!audioScan) scanForAudio(); 1019 if(!audioScan) scanForAudio();
1020 1020
1021 QListIterator<DocLnk> dit( files.children() ); 1021 QListIterator<DocLnk> dit( files.children() );
1022 QListIterator<FileSystem> it ( fs ); 1022 QListIterator<FileSystem> it ( fs );
1023 1023
1024 QString storage; 1024 QString storage;
1025 for ( ; dit.current(); ++dit ) { 1025 for ( ; dit.current(); ++dit ) {
1026 for( ; it.current(); ++it ){ 1026 for( ; it.current(); ++it ){
1027 const QString name = (*it)->name(); 1027 const QString name = (*it)->name();
1028 const QString path = (*it)->path(); 1028 const QString path = (*it)->path();
1029 if(dit.current()->file().find(path) != -1 ) storage=name; 1029 if(dit.current()->file().find(path) != -1 ) storage=name;
1030 } 1030 }
1031 1031
1032 QListViewItem * newItem; 1032 QListViewItem * newItem;
1033 if ( QFile( dit.current()->file()).exists() ) { 1033 if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
1034// qDebug(dit.current()->name()); 1034 long size;
1035 if( dit.current()->file().left(4) == "http" )
1036 size=0;
1037 else
1038 size = QFile( dit.current()->file() ).size();
1035 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 1039 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
1036 QString::number( QFile( dit.current()->file()).size() ), storage); 1040 QString::number(size ), storage);
1037 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); 1041 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" ));
1038 } 1042 }
1039 } 1043 }
1040 1044
1041} 1045}
1042 1046
1043void PlayListWidget::populateVideoView() { 1047void PlayListWidget::populateVideoView() {
1044 videoView->clear(); 1048 videoView->clear();
1045 StorageInfo storageInfo; 1049 StorageInfo storageInfo;
1046 const QList<FileSystem> &fs = storageInfo.fileSystems(); 1050 const QList<FileSystem> &fs = storageInfo.fileSystems();
1047 1051
1048 if(!videoScan ) scanForVideo(); 1052 if(!videoScan ) scanForVideo();
1049 1053
1050 QListIterator<DocLnk> Vdit( vFiles.children() ); 1054 QListIterator<DocLnk> Vdit( vFiles.children() );
1051 QListIterator<FileSystem> it ( fs ); 1055 QListIterator<FileSystem> it ( fs );
1052 videoView->clear(); 1056 videoView->clear();
1053 QString storage; 1057 QString storage;
1054 for ( ; Vdit.current(); ++Vdit ) { 1058 for ( ; Vdit.current(); ++Vdit ) {
1055 for( ; it.current(); ++it ){ 1059 for( ; it.current(); ++it ){
1056 const QString name = (*it)->name(); 1060 const QString name = (*it)->name();
1057 const QString path = (*it)->path(); 1061 const QString path = (*it)->path();
1058 if( Vdit.current()->file().find(path) != -1 ) storage=name; 1062 if( Vdit.current()->file().find(path) != -1 ) storage=name;
1059 } 1063 }
1060 1064
1061 QListViewItem * newItem; 1065 QListViewItem * newItem;
1062 if ( QFile( Vdit.current()->file()).exists() ) { 1066 if ( QFile( Vdit.current()->file()).exists() ) {
1063 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 1067 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
1064 QString::number( QFile( Vdit.current()->file()).size() ), storage); 1068 QString::number( QFile( Vdit.current()->file()).size() ), storage);
1065 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); 1069 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" ));
1066 } 1070 }
1067 } 1071 }
1068} 1072}
1069 1073
1070void PlayListWidget::openFile() { 1074void PlayListWidget::openFile() {
1071 QString filename, name; 1075 QString filename, name;
1072 InputDialog *fileDlg; 1076 InputDialog *fileDlg;
1073 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 1077 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
1074 fileDlg->exec(); 1078 fileDlg->exec();
1075 if( fileDlg->result() == 1 ) { 1079 if( fileDlg->result() == 1 ) {
1076 filename = fileDlg->LineEdit1->text(); 1080 filename = fileDlg->LineEdit1->text();
1077// http://205.188.234.129:8030 1081// http://205.188.234.129:8030
1078// http://66.28.68.70:8000 1082// http://66.28.68.70:8000
1079// filename.replace(QRegExp("%20")," "); 1083// filename.replace(QRegExp("%20")," ");
1080 qDebug("Selected filename is "+filename); 1084 qDebug("Selected filename is "+filename);
1081 if(filename.right(3) == "m3u") 1085 if(filename.right(3) == "m3u")
1082 readm3u( filename); 1086 readm3u( filename);
1083 else if(filename.right(3) == "pls") 1087 else if(filename.right(3) == "pls")
1084 readPls( filename); 1088 readPls( filename);
1085 else { 1089 else {
1086 DocLnk lnk; 1090 DocLnk lnk;
1087 1091
1088 lnk.setName(filename); //sets file name 1092 lnk.setName(filename); //sets file name
1089 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3") 1093 if(filename.right(1) != "/" && filename.right(3) != "mp3" && filename.right(3) != "MP3")
1090 filename += "/"; 1094 filename += "/";
1091 lnk.setFile(filename); //sets File property 1095 lnk.setFile(filename); //sets File property
1092 1096
1093 lnk.setType("audio/x-mpegurl"); 1097 lnk.setType("audio/x-mpegurl");
1094 lnk.setExec("opieplayer"); 1098 lnk.setExec("opieplayer");
1095 lnk.setIcon("opieplayer/MPEGPlayer"); 1099 lnk.setIcon("opieplayer/MPEGPlayer");
1096 1100
1097 if(!lnk.writeLink()) 1101 if(!lnk.writeLink())
1098 qDebug("Writing doclink did not work"); 1102 qDebug("Writing doclink did not work");
1099 d->selectedFiles->addToSelection( lnk); 1103 d->selectedFiles->addToSelection( lnk);
1100// if(fileDlg2) 1104// if(fileDlg2)
1101// delete fileDlg2; 1105// delete fileDlg2;
1102 } 1106 }
1103 } 1107 }
1104 if(fileDlg) 1108 if(fileDlg)
1105 delete fileDlg; 1109 delete fileDlg;
1106} 1110}
1107 1111
1108void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 1112void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1109{ 1113{
1110 switch ( e->key() ) { 1114 switch ( e->key() ) {
1111////////////////////////////// Zaurus keys 1115////////////////////////////// Zaurus keys
1112 case Key_F9: //activity 1116 case Key_F9: //activity
1113// if(audioUI->isHidden()) 1117// if(audioUI->isHidden())
1114// audioUI->showMaximized(); 1118// audioUI->showMaximized();
1115 break; 1119 break;
1116 case Key_F10: //contacts 1120 case Key_F10: //contacts
1117// if( videoUI->isHidden()) 1121// if( videoUI->isHidden())
1118// videoUI->showMaximized(); 1122// videoUI->showMaximized();
1119 break; 1123 break;
1120 case Key_F11: //menu 1124 case Key_F11: //menu
1121 break; 1125 break;
1122 case Key_F12: //home 1126 case Key_F12: //home
1123// doBlank(); 1127// doBlank();
1124 break; 1128 break;
1125 case Key_F13: //mail 1129 case Key_F13: //mail
1126// doUnblank(); 1130// doUnblank();
1127 break; 1131 break;
1128 case Key_Q: //add to playlist 1132 case Key_Q: //add to playlist
1129 qDebug("Add"); 1133 qDebug("Add");
1130 addSelected(); 1134 addSelected();
1131 break; 1135 break;
1132 case Key_R: //remove from playlist 1136 case Key_R: //remove from playlist
1133 removeSelected(); 1137 removeSelected();
1134 break; 1138 break;
1135// case Key_P: //play 1139// case Key_P: //play
1136// qDebug("Play"); 1140// qDebug("Play");
1137// playSelected(); 1141// playSelected();
1138// break; 1142// break;
1139 case Key_Space: 1143 case Key_Space:
1140 qDebug("Play"); 1144 qDebug("Play");
1141// playSelected(); puh 1145// playSelected(); puh
1142 break; 1146 break;
1143 case Key_1: 1147 case Key_1:
1144 tabWidget->setCurrentPage(0); 1148 tabWidget->setCurrentPage(0);
1145 break; 1149 break;
1146 case Key_2: 1150 case Key_2:
1147 tabWidget->setCurrentPage(1); 1151 tabWidget->setCurrentPage(1);
1148 break; 1152 break;
1149 case Key_3: 1153 case Key_3:
1150 tabWidget->setCurrentPage(2); 1154 tabWidget->setCurrentPage(2);
1151 break; 1155 break;
1152 case Key_4: 1156 case Key_4:
1153 tabWidget->setCurrentPage(3); 1157 tabWidget->setCurrentPage(3);
1154 break; 1158 break;
1155 case Key_Down: 1159 case Key_Down:
1156 if ( !d->selectedFiles->next() ) 1160 if ( !d->selectedFiles->next() )
1157 d->selectedFiles->first(); 1161 d->selectedFiles->first();
1158 1162
1159 break; 1163 break;
1160 case Key_Up: 1164 case Key_Up:
1161 if ( !d->selectedFiles->prev() ) 1165 if ( !d->selectedFiles->prev() )
1162 // d->selectedFiles->last(); 1166 // d->selectedFiles->last();
1163 1167
1164 break; 1168 break;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 603a7a3..6c4d07f 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -604,260 +604,263 @@ void PlayListWidget::tabChanged(QWidget *) {
604 604
605 if( !tbDeletePlaylist->isHidden() ) { 605 if( !tbDeletePlaylist->isHidden() ) {
606 tbDeletePlaylist->hide(); 606 tbDeletePlaylist->hide();
607 } 607 }
608 d->tbRemoveFromList->setEnabled(FALSE); 608 d->tbRemoveFromList->setEnabled(FALSE);
609 d->tbAddToList->setEnabled(TRUE); 609 d->tbAddToList->setEnabled(TRUE);
610 } 610 }
611 break; 611 break;
612 case 2: 612 case 2:
613 { 613 {
614 videoView->clear(); 614 videoView->clear();
615 populateVideoView(); 615 populateVideoView();
616 if( !tbDeletePlaylist->isHidden() ) { 616 if( !tbDeletePlaylist->isHidden() ) {
617 tbDeletePlaylist->hide(); 617 tbDeletePlaylist->hide();
618 } 618 }
619 d->tbRemoveFromList->setEnabled(FALSE); 619 d->tbRemoveFromList->setEnabled(FALSE);
620 d->tbAddToList->setEnabled(TRUE); 620 d->tbAddToList->setEnabled(TRUE);
621 } 621 }
622 break; 622 break;
623 case 3: 623 case 3:
624 { 624 {
625 if( tbDeletePlaylist->isHidden() ) { 625 if( tbDeletePlaylist->isHidden() ) {
626 tbDeletePlaylist->show(); 626 tbDeletePlaylist->show();
627 } 627 }
628 playLists->reread(); 628 playLists->reread();
629 } 629 }
630 break; 630 break;
631 }; 631 };
632} 632}
633 633
634 634
635void PlayListWidget::btnPlay(bool b) { 635void PlayListWidget::btnPlay(bool b) {
636 // mediaPlayerState->setPlaying(b); 636 // mediaPlayerState->setPlaying(b);
637 switch ( tabWidget->currentPageIndex()) { 637 switch ( tabWidget->currentPageIndex()) {
638 case 0: 638 case 0:
639 { 639 {
640 mediaPlayerState->setPlaying(b); 640 mediaPlayerState->setPlaying(b);
641 } 641 }
642 break; 642 break;
643 case 1: 643 case 1:
644 { 644 {
645 addToSelection( audioView->currentItem() ); 645 addToSelection( audioView->currentItem() );
646 mediaPlayerState->setPlaying(b); 646 mediaPlayerState->setPlaying(b);
647 d->selectedFiles->removeSelected( ); 647 d->selectedFiles->removeSelected( );
648 tabWidget->setCurrentPage(1); 648 tabWidget->setCurrentPage(1);
649 d->selectedFiles->unSelect(); 649 d->selectedFiles->unSelect();
650 insanityBool=FALSE; 650 insanityBool=FALSE;
651 }// audioView->clearSelection(); 651 }// audioView->clearSelection();
652 break; 652 break;
653 case 2: 653 case 2:
654 { 654 {
655 addToSelection( videoView->currentItem() ); 655 addToSelection( videoView->currentItem() );
656 mediaPlayerState->setPlaying(b); 656 mediaPlayerState->setPlaying(b);
657 qApp->processEvents(); 657 qApp->processEvents();
658 d->selectedFiles->removeSelected( ); 658 d->selectedFiles->removeSelected( );
659 tabWidget->setCurrentPage(2); 659 tabWidget->setCurrentPage(2);
660 d->selectedFiles->unSelect(); 660 d->selectedFiles->unSelect();
661 insanityBool=FALSE; 661 insanityBool=FALSE;
662 }// videoView->clearSelection(); 662 }// videoView->clearSelection();
663 break; 663 break;
664 }; 664 };
665 665
666} 666}
667 667
668void PlayListWidget::deletePlaylist() { 668void PlayListWidget::deletePlaylist() {
669 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 669 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
670 (tr("You really want to delete\nthis playlist?")), 670 (tr("You really want to delete\nthis playlist?")),
671 (tr("Yes")), (tr("No")), 0 )){ 671 (tr("Yes")), (tr("No")), 0 )){
672 case 0: // Yes clicked, 672 case 0: // Yes clicked,
673 QFile().remove(playLists->selected()->file()); 673 QFile().remove(playLists->selected()->file());
674 QFile().remove(playLists->selected()->linkFile()); 674 QFile().remove(playLists->selected()->linkFile());
675 playLists->reread(); 675 playLists->reread();
676 break; 676 break;
677 case 1: // Cancel 677 case 1: // Cancel
678 break; 678 break;
679 }; 679 };
680} 680}
681 681
682 682
683void PlayListWidget::playSelected() { 683void PlayListWidget::playSelected() {
684 btnPlay( TRUE); 684 btnPlay( TRUE);
685} 685}
686 686
687 687
688void PlayListWidget::scanForAudio() { 688void PlayListWidget::scanForAudio() {
689// qDebug("scan for audio"); 689// qDebug("scan for audio");
690 files.detachChildren(); 690 files.detachChildren();
691 QListIterator<DocLnk> sdit( files.children() ); 691 QListIterator<DocLnk> sdit( files.children() );
692 for ( ; sdit.current(); ++sdit ) { 692 for ( ; sdit.current(); ++sdit ) {
693 delete sdit.current(); 693 delete sdit.current();
694 } 694 }
695 Global::findDocuments(&files, "audio/*"); 695 Global::findDocuments(&files, "audio/*");
696 audioScan = TRUE; 696 audioScan = TRUE;
697} 697}
698 698
699void PlayListWidget::scanForVideo() { 699void PlayListWidget::scanForVideo() {
700// qDebug("scan for video"); 700// qDebug("scan for video");
701 vFiles.detachChildren(); 701 vFiles.detachChildren();
702 QListIterator<DocLnk> sdit( vFiles.children() ); 702 QListIterator<DocLnk> sdit( vFiles.children() );
703 for ( ; sdit.current(); ++sdit ) { 703 for ( ; sdit.current(); ++sdit ) {
704 delete sdit.current(); 704 delete sdit.current();
705 } 705 }
706 Global::findDocuments(&vFiles, "video/*"); 706 Global::findDocuments(&vFiles, "video/*");
707 videoScan = TRUE; 707 videoScan = TRUE;
708} 708}
709 709
710void PlayListWidget::populateAudioView() { 710void PlayListWidget::populateAudioView() {
711 audioView->clear(); 711 audioView->clear();
712 StorageInfo storageInfo; 712 StorageInfo storageInfo;
713 const QList<FileSystem> &fs = storageInfo.fileSystems(); 713 const QList<FileSystem> &fs = storageInfo.fileSystems();
714 if(!audioScan) { 714 if(!audioScan) {
715 scanForAudio(); 715 scanForAudio();
716 } 716 }
717 717
718 QListIterator<DocLnk> dit( files.children() ); 718 QListIterator<DocLnk> dit( files.children() );
719 QListIterator<FileSystem> it ( fs ); 719 QListIterator<FileSystem> it ( fs );
720 720
721 QString storage; 721 QString storage;
722 for ( ; dit.current(); ++dit ) { 722 for ( ; dit.current(); ++dit ) {
723 for( ; it.current(); ++it ){ 723 for( ; it.current(); ++it ){
724 const QString name = (*it)->name(); 724 const QString name = (*it)->name();
725 const QString path = (*it)->path(); 725 const QString path = (*it)->path();
726 if(dit.current()->file().find(path) != -1 ) { 726 if(dit.current()->file().find(path) != -1 ) {
727 storage = name; 727 storage = name;
728 } 728 }
729 } 729 }
730 730
731 QListViewItem * newItem; 731 QListViewItem * newItem;
732 if ( QFile( dit.current()->file()).exists() ) { 732 if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
733 // qDebug(dit.current()->name()); 733 long size;
734 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 734 if( dit.current()->file().left(4) == "http" )
735 QString::number( QFile( dit.current()->file()).size() ), storage); 735 size=0;
736 else
737 size = QFile( dit.current()->file() ).size();
738 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number(size ), storage);
736 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); 739 newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
737 } 740 }
738 } 741 }
739} 742}
740 743
741 744
742void PlayListWidget::populateVideoView() { 745void PlayListWidget::populateVideoView() {
743 videoView->clear(); 746 videoView->clear();
744 StorageInfo storageInfo; 747 StorageInfo storageInfo;
745 const QList<FileSystem> &fs = storageInfo.fileSystems(); 748 const QList<FileSystem> &fs = storageInfo.fileSystems();
746 749
747 if(!videoScan ) { 750 if(!videoScan ) {
748 scanForVideo(); 751 scanForVideo();
749 } 752 }
750 753
751 QListIterator<DocLnk> Vdit( vFiles.children() ); 754 QListIterator<DocLnk> Vdit( vFiles.children() );
752 QListIterator<FileSystem> it ( fs ); 755 QListIterator<FileSystem> it ( fs );
753 videoView->clear(); 756 videoView->clear();
754 QString storage; 757 QString storage;
755 for ( ; Vdit.current(); ++Vdit ) { 758 for ( ; Vdit.current(); ++Vdit ) {
756 for( ; it.current(); ++it ) { 759 for( ; it.current(); ++it ) {
757 const QString name = (*it)->name(); 760 const QString name = (*it)->name();
758 const QString path = (*it)->path(); 761 const QString path = (*it)->path();
759 if( Vdit.current()->file().find(path) != -1 ) { 762 if( Vdit.current()->file().find(path) != -1 ) {
760 storage=name; 763 storage=name;
761 } 764 }
762 } 765 }
763 766
764 QListViewItem * newItem; 767 QListViewItem * newItem;
765 if ( QFile( Vdit.current()->file() ).exists() ) { 768 if ( QFile( Vdit.current()->file() ).exists() ) {
766 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 769 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
767 QString::number( QFile( Vdit.current()->file() ).size() ), storage ); 770 QString::number( QFile( Vdit.current()->file() ).size() ), storage );
768 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); 771 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
769 } 772 }
770 } 773 }
771} 774}
772 775
773 776
774void PlayListWidget::openFile() { 777void PlayListWidget::openFile() {
775 QString filename, name; 778 QString filename, name;
776 InputDialog *fileDlg; 779 InputDialog *fileDlg;
777 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 780 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
778 fileDlg->exec(); 781 fileDlg->exec();
779 if( fileDlg->result() == 1 ) { 782 if( fileDlg->result() == 1 ) {
780 filename = fileDlg->text(); 783 filename = fileDlg->text();
781 784
782 qDebug( "Selected filename is " + filename ); 785 qDebug( "Selected filename is " + filename );
783 if( filename.right( 3 ) == "m3u" ) { 786 if( filename.right( 3 ) == "m3u" ) {
784 readm3u( filename ); 787 readm3u( filename );
785 } else if( filename.right(3) == "pls" ) { 788 } else if( filename.right(3) == "pls" ) {
786 readPls( filename ); 789 readPls( filename );
787 } else { 790 } else {
788 // this doesnt need fixing 791 // this doesnt need fixing
789 DocLnk lnk; 792 DocLnk lnk;
790 lnk.setName( filename ); //sets file name 793 lnk.setName( filename ); //sets file name
791 lnk.setFile( filename ); //sets File property 794 lnk.setFile( filename ); //sets File property
792 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); 795 //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() );
793 lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); 796 lnk.setType( MimeType( QFile::encodeName(filename) ).id() );
794 lnk.setExec( "opieplayer" ); 797 lnk.setExec( "opieplayer" );
795 lnk.setIcon( "opieplayer2/MPEGPlayer" ); 798 lnk.setIcon( "opieplayer2/MPEGPlayer" );
796 799
797 if( !lnk.writeLink() ) { 800 if( !lnk.writeLink() ) {
798 qDebug( "Writing doclink did not work" ); 801 qDebug( "Writing doclink did not work" );
799 } 802 }
800 d->selectedFiles->addToSelection( lnk ); 803 d->selectedFiles->addToSelection( lnk );
801 } 804 }
802 } 805 }
803 if( fileDlg ) { 806 if( fileDlg ) {
804 delete fileDlg; 807 delete fileDlg;
805 } 808 }
806} 809}
807 810
808void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { 811void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
809 switch ( e->key() ) { 812 switch ( e->key() ) {
810 ////////////////////////////// Zaurus keys 813 ////////////////////////////// Zaurus keys
811 case Key_F9: //activity 814 case Key_F9: //activity
812 // if(audioUI->isHidden()) 815 // if(audioUI->isHidden())
813 // audioUI->showMaximized(); 816 // audioUI->showMaximized();
814 break; 817 break;
815 case Key_F10: //contacts 818 case Key_F10: //contacts
816 // if( videoUI->isHidden()) 819 // if( videoUI->isHidden())
817 // videoUI->showMaximized(); 820 // videoUI->showMaximized();
818 break; 821 break;
819 case Key_F11: //menu 822 case Key_F11: //menu
820 break; 823 break;
821 case Key_F12: //home 824 case Key_F12: //home
822 // doBlank(); 825 // doBlank();
823 break; 826 break;
824 case Key_F13: //mail 827 case Key_F13: //mail
825 // doUnblank(); 828 // doUnblank();
826 break; 829 break;
827 case Key_Q: //add to playlist 830 case Key_Q: //add to playlist
828 addSelected(); 831 addSelected();
829 break; 832 break;
830 case Key_R: //remove from playlist 833 case Key_R: //remove from playlist
831 removeSelected(); 834 removeSelected();
832 break; 835 break;
833 // case Key_P: //play 836 // case Key_P: //play
834 // qDebug("Play"); 837 // qDebug("Play");
835 // playSelected(); 838 // playSelected();
836 // break; 839 // break;
837 case Key_Space: 840 case Key_Space:
838 // playSelected(); puh 841 // playSelected(); puh
839 break; 842 break;
840 case Key_1: 843 case Key_1:
841 tabWidget->setCurrentPage( 0 ); 844 tabWidget->setCurrentPage( 0 );
842 break; 845 break;
843 case Key_2: 846 case Key_2:
844 tabWidget->setCurrentPage( 1 ); 847 tabWidget->setCurrentPage( 1 );
845 break; 848 break;
846 case Key_3: 849 case Key_3:
847 tabWidget->setCurrentPage( 2 ); 850 tabWidget->setCurrentPage( 2 );
848 break; 851 break;
849 case Key_4: 852 case Key_4:
850 tabWidget->setCurrentPage( 3 ); 853 tabWidget->setCurrentPage( 3 );
851 break; 854 break;
852 case Key_Down: 855 case Key_Down:
853 if ( !d->selectedFiles->next() ) 856 if ( !d->selectedFiles->next() )
854 d->selectedFiles->first(); 857 d->selectedFiles->first();
855 858
856 break; 859 break;
857 case Key_Up: 860 case Key_Up:
858 if ( !d->selectedFiles->prev() ) 861 if ( !d->selectedFiles->prev() )
859 // d->selectedFiles->last(); 862 // d->selectedFiles->last();
860 863
861 break; 864 break;
862 865
863 } 866 }