summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/playlistwidget.cpp
authorllornkcor <llornkcor>2003-04-26 02:02:26 (UTC)
committer llornkcor <llornkcor>2003-04-26 02:02:26 (UTC)
commit908a099ba19192dcb341959125efce6cf0df20f1 (patch) (unidiff)
treead59a689d097b1a4ffccb3ca849e936c48a9cad0 /core/multimedia/opieplayer/playlistwidget.cpp
parent4a5b422ef2410d89aa1c3624da2ead151d815ecd (diff)
downloadopie-908a099ba19192dcb341959125efce6cf0df20f1.zip
opie-908a099ba19192dcb341959125efce6cf0df20f1.tar.gz
opie-908a099ba19192dcb341959125efce6cf0df20f1.tar.bz2
change playlist file access mode when writing
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 795feaf..c6de5e6 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -1223,97 +1223,97 @@ void PlayListWidget::readPls( const QString &filename ) {
1223 1223
1224/* 1224/*
1225 writes current playlist to current m3u file */ 1225 writes current playlist to current m3u file */
1226void PlayListWidget::writeCurrentM3u() { 1226void PlayListWidget::writeCurrentM3u() {
1227 qDebug("writing to current m3u"); 1227 qDebug("writing to current m3u");
1228 Config cfg( "OpiePlayer" ); 1228 Config cfg( "OpiePlayer" );
1229 cfg.setGroup("PlayList"); 1229 cfg.setGroup("PlayList");
1230 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 1230 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
1231 Om3u *m3uList; 1231 Om3u *m3uList;
1232 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 1232 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
1233 1233
1234 if( d->selectedFiles->first()) { 1234 if( d->selectedFiles->first()) {
1235 do { 1235 do {
1236 qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); 1236 qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file());
1237 m3uList->add( d->selectedFiles->current()->file() ); 1237 m3uList->add( d->selectedFiles->current()->file() );
1238 } 1238 }
1239 while ( d->selectedFiles->next() ); 1239 while ( d->selectedFiles->next() );
1240 qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); 1240 qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
1241 m3uList->write(); 1241 m3uList->write();
1242 m3uList->close(); 1242 m3uList->close();
1243 1243
1244 if(m3uList) delete m3uList; 1244 if(m3uList) delete m3uList;
1245 } 1245 }
1246} 1246}
1247 1247
1248 /* 1248 /*
1249 writes current playlist to m3u file */ 1249 writes current playlist to m3u file */
1250void PlayListWidget::writem3u() { 1250void PlayListWidget::writem3u() {
1251 InputDialog *fileDlg; 1251 InputDialog *fileDlg;
1252 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); 1252 fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
1253 fileDlg->exec(); 1253 fileDlg->exec();
1254 QString name, filename, list; 1254 QString name, filename, list;
1255 Om3u *m3uList; 1255 Om3u *m3uList;
1256 1256
1257 if( fileDlg->result() == 1 ) { 1257 if( fileDlg->result() == 1 ) {
1258 name = fileDlg->text(); 1258 name = fileDlg->text();
1259// qDebug( filename ); 1259// qDebug( filename );
1260 if( name.find("/",0,true) != -1) {// assume they specify a file path 1260 if( name.find("/",0,true) != -1) {// assume they specify a file path
1261 filename = name; 1261 filename = name;
1262 name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); 1262 name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
1263 } 1263 }
1264 else //otherwise dump it somewhere noticable 1264 else //otherwise dump it somewhere noticable
1265 filename = QPEApplication::documentDir() + "/" + name; 1265 filename = QPEApplication::documentDir() + "/" + name;
1266 1266
1267 if( filename.right( 3 ) != "m3u" ) //needs filename extension 1267 if( filename.right( 3 ) != "m3u" ) //needs filename extension
1268 filename += ".m3u"; 1268 filename += ".m3u";
1269 1269
1270 if( d->selectedFiles->first()) { 1270 if( d->selectedFiles->first()) {
1271 m3uList = new Om3u(filename, IO_ReadWrite); 1271 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
1272 1272
1273 do { 1273 do {
1274 m3uList->add( d->selectedFiles->current()->file()); 1274 m3uList->add( d->selectedFiles->current()->file());
1275 } 1275 }
1276 while ( d->selectedFiles->next() ); 1276 while ( d->selectedFiles->next() );
1277 // qDebug( list ); 1277 // qDebug( list );
1278 m3uList->write(); 1278 m3uList->write();
1279 m3uList->close(); 1279 m3uList->close();
1280 if(m3uList) delete m3uList; 1280 if(m3uList) delete m3uList;
1281 1281
1282 if(fileDlg) delete fileDlg; 1282 if(fileDlg) delete fileDlg;
1283 1283
1284 DocLnk lnk; 1284 DocLnk lnk;
1285 lnk.setFile( filename); 1285 lnk.setFile( filename);
1286 lnk.setIcon("opieplayer2/playlist2"); 1286 lnk.setIcon("opieplayer2/playlist2");
1287 lnk.setName( name); //sets file name 1287 lnk.setName( name); //sets file name
1288 1288
1289 // qDebug(filename); 1289 // qDebug(filename);
1290 Config config( "OpiePlayer" ); 1290 Config config( "OpiePlayer" );
1291 config.setGroup( "PlayList" ); 1291 config.setGroup( "PlayList" );
1292 1292
1293 config.writeEntry("CurrentPlaylist",filename); 1293 config.writeEntry("CurrentPlaylist",filename);
1294 currentPlayList=filename; 1294 currentPlayList=filename;
1295 1295
1296 if(!lnk.writeLink()) { 1296 if(!lnk.writeLink()) {
1297 qDebug("Writing doclink did not work"); 1297 qDebug("Writing doclink did not work");
1298 } 1298 }
1299 1299
1300 setCaption(tr("OpiePlayer: ") + name); 1300 setCaption(tr("OpiePlayer: ") + name);
1301 } 1301 }
1302 } 1302 }
1303} 1303}
1304 1304
1305 1305
1306void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 1306void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1307{ 1307{
1308 switch ( e->key() ) { 1308 switch ( e->key() ) {
1309////////////////////////////// Zaurus keys 1309////////////////////////////// Zaurus keys
1310 case Key_F9: //activity 1310 case Key_F9: //activity
1311// if(audioUI->isHidden()) 1311// if(audioUI->isHidden())
1312// audioUI->showMaximized(); 1312// audioUI->showMaximized();
1313 break; 1313 break;
1314 case Key_F10: //contacts 1314 case Key_F10: //contacts
1315// if( videoUI->isHidden()) 1315// if( videoUI->isHidden())
1316// videoUI->showMaximized(); 1316// videoUI->showMaximized();
1317 break; 1317 break;
1318 case Key_F11: //menu 1318 case Key_F11: //menu
1319 break; 1319 break;