-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 11f9752..4b1ff22 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -925,81 +925,79 @@ void PlayListWidget::listDelete() { | |||
925 | }; | 925 | }; |
926 | } | 926 | } |
927 | 927 | ||
928 | void PlayListWidget::populateAudioView() { | 928 | void PlayListWidget::populateAudioView() { |
929 | // if(files) | 929 | // if(files) |
930 | // files.~DocLnkSet(); | 930 | // files.~DocLnkSet(); |
931 | StorageInfo storageInfo; | 931 | StorageInfo storageInfo; |
932 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 932 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
933 | 933 | ||
934 | Global::findDocuments(&files, "audio/*"); | 934 | Global::findDocuments(&files, "audio/*"); |
935 | QListIterator<DocLnk> dit( files.children() ); | 935 | QListIterator<DocLnk> dit( files.children() ); |
936 | QListIterator<FileSystem> it ( fs ); | 936 | QListIterator<FileSystem> it ( fs ); |
937 | audioView->clear(); | 937 | audioView->clear(); |
938 | QString storage; | 938 | QString storage; |
939 | for ( ; dit.current(); ++dit ) { | 939 | for ( ; dit.current(); ++dit ) { |
940 | for( ; it.current(); ++it ){ | 940 | for( ; it.current(); ++it ){ |
941 | const QString name = (*it)->name(); | 941 | const QString name = (*it)->name(); |
942 | const QString path = (*it)->path(); | 942 | const QString path = (*it)->path(); |
943 | if(dit.current()->file().find(path) != -1 ) storage=name; | 943 | if(dit.current()->file().find(path) != -1 ) storage=name; |
944 | } | 944 | } |
945 | 945 | ||
946 | QListViewItem * newItem; | 946 | QListViewItem * newItem; |
947 | if ( QFile( dit.current()->file()).exists() ) { | 947 | if ( QFile( dit.current()->file()).exists() ) { |
948 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); | 948 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), QString::number( QFile( dit.current()->file()).size() ), storage); |
949 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); | 949 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/musicfile" )); |
950 | } | 950 | } |
951 | } | 951 | } |
952 | } | 952 | } |
953 | 953 | ||
954 | void PlayListWidget::populateVideoView() { | 954 | void PlayListWidget::populateVideoView() { |
955 | StorageInfo storageInfo; | 955 | StorageInfo storageInfo; |
956 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 956 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
957 | 957 | ||
958 | Global::findDocuments(&vFiles, "video/*"); | 958 | Global::findDocuments(&vFiles, "video/*"); |
959 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 959 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
960 | QListIterator<FileSystem> it ( fs ); | 960 | QListIterator<FileSystem> it ( fs ); |
961 | videoView->clear(); | 961 | videoView->clear(); |
962 | QString storage; | 962 | QString storage; |
963 | for ( ; Vdit.current(); ++Vdit ) { | 963 | for ( ; Vdit.current(); ++Vdit ) { |
964 | for( ; it.current(); ++it ){ | 964 | for( ; it.current(); ++it ){ |
965 | const QString name = (*it)->name(); | 965 | const QString name = (*it)->name(); |
966 | const QString path = (*it)->path(); | 966 | const QString path = (*it)->path(); |
967 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 967 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
968 | } | 968 | } |
969 | 969 | ||
970 | QListViewItem * newItem; | 970 | QListViewItem * newItem; |
971 | if ( QFile( Vdit.current()->file()).exists() ) { | 971 | if ( QFile( Vdit.current()->file()).exists() ) { |
972 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); | 972 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), QString::number( QFile( Vdit.current()->file()).size() ), storage); |
973 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); | 973 | newItem->setPixmap(0, Resource::loadPixmap( "mpegplayer/videofile" )); |
974 | } | 974 | } |
975 | } | 975 | } |
976 | } | 976 | } |
977 | 977 | ||
978 | void PlayListWidget::openFile() { | 978 | void PlayListWidget::openFile() { |
979 | QString filename; | 979 | QString filename; |
980 | InputDialog *fileDlg; | 980 | InputDialog *fileDlg; |
981 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 981 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
982 | fileDlg->exec(); | 982 | fileDlg->exec(); |
983 | if( fileDlg->result() == 1 ) { | 983 | if( fileDlg->result() == 1 ) { |
984 | filename = fileDlg->LineEdit1->text(); | 984 | filename = fileDlg->LineEdit1->text(); |
985 | } | 985 | } |
986 | qDebug(filename); | 986 | qDebug(filename); |
987 | DocLnk lnk; | 987 | DocLnk lnk; |
988 | QString name = filename.right(filename.length()-filename.find("http://")-7); | 988 | QString name = filename.right(filename.length()-filename.find("http://")-7); |
989 | qDebug(name); | ||
989 | lnk.setName( name); //sets file name | 990 | lnk.setName( name); //sets file name |
990 | // lnk.setComment(); | 991 | // lnk.setComment(); |
991 | lnk.setFile(filename); //sets File property | 992 | lnk.setFile(filename); //sets File property |
992 | // problem is, the launcher sees this as a broken link and does not display it :( | 993 | // problem is, the launcher sees this as a broken link and does not display it :( |
993 | |||
994 | lnk.setType("audio/x-mpegurl"); | 994 | lnk.setType("audio/x-mpegurl"); |
995 | lnk.setExec("opieplayer"); | 995 | lnk.setExec("opieplayer"); |
996 | lnk.setIcon("opieplayer/MPEGPlayer"); | 996 | lnk.setIcon("opieplayer/MPEGPlayer"); |
997 | QString cmd="touch "+QPEApplication::documentDir()+"audio/x-mpegurl/"+name; | ||
998 | system( cmd.latin1()); | ||
999 | // d->selectedFiles->addToSelection( **dit ); | ||
1000 | 997 | ||
1001 | if(!lnk.writeLink()) | 998 | if(!lnk.writeLink()) |
1002 | qDebug("Writing doclink did not work"); | 999 | qDebug("Writing doclink did not work"); |
1000 | d->selectedFiles->addToSelection( lnk); | ||
1003 | if(fileDlg) | 1001 | if(fileDlg) |
1004 | delete fileDlg; | 1002 | delete fileDlg; |
1005 | } | 1003 | } |