From kde-devel Sun Jul 13 18:21:52 2003 From: Adriaan de Groot Date: Sun, 13 Jul 2003 18:21:52 +0000 To: kde-devel Subject: Re: Release: Music Manager Konqueror Plugin X-MARC-Message: https://marc.info/?l=kde-devel&m=105818121814991 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_ANaE/Hya9G0eclI" --Boundary-00=_ANaE/Hya9G0eclI Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Avi, It took a little wrestling to get musicman to compile - like Aaron pointed= =20 out, there are some #includes missing (system and library headers are=20 notoriously difficult to get to work properly; I needed to add stdlib.h for= =20 free() and math.h for floor()). There's also some bmake problems with .ui=20 files, but those are universal in KDE, nothing a make -k ; make won't cure. On Thursday 10 July 2003 18:47, Christian Loose wrote: > Am Donnerstag, 10. Juli 2003 03:25 schrieb Avi: > > Hi, > > > > I developed a Konqueror plugin to help me organize my large number of > > MP3, Ogg files. > > I'd like to release it here to the developer comunity before I put it as > > public. > Some problems I encountered: > - the desktop file 'musicman.desktop' wasn't installed by make install Indeed. I copied it to $KDEDIR/share/services/ by hand and ran kbuildsycoca= ,=20 and it worked. At least, the menu entries are added for .mp3 files, and I c= an=20 call up the create CD cover function (with empty list boxes because of the= =20 missing templates). I'm slightly surprised it does nothing for .oggs. Do you just not have any= =20 oggs in your collection?=20 Attached, please find the diff to change from scandir() to QDir in one plac= e=20 (there's three in musicindexgenerator.cpp). I couldn't test it, because of= =20 the uninstalled templates + I don't know how to get on that code path, but = it=20 does compile. I hope it illustrates sufficiently how the QDir API can be us= ed=20 and that it's simpler than scandir().=20 =2D --=20 pub 1024D/FEA2A3FE 2002-06-18 Adriaan de Groot Key fingerprint =3D 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE/EaNAdqzuAf6io/4RAvF0AJ48m+XazPnOz0DqYajDV6LinocGPACgkDGu zR/nWyLXd6o+otWTJoo90/Y=3D =3Dddt7 =2D----END PGP SIGNATURE----- --Boundary-00=_ANaE/Hya9G0eclI Content-Type: text/x-diff; charset="iso-8859-1"; name="musicman.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="musicman.diff" --- musicindexgenerator.cpp.orig Sun Jul 13 18:58:39 2003 +++ musicindexgenerator.cpp Sun Jul 13 20:17:25 2003 @@ -254,37 +254,26 @@ KURL::List layout; QStringList resDirs; KIO::Job *job; - struct dirent **namelist; - int n; - // Find CD layout template dir resDirs=KGlobal::dirs()->findDirs("data","musicman/cdRootLayout"); - if (resDirs.count()) { - // List all files in first template - n = scandir((*(QStringList::Iterator)resDirs.begin()).ascii(), - &namelist, 0, alphasort); + if (!resDirs.count()) return; // No template dir found. - // Build the KURL::List of template items to copy - while (n--) { - KURL entry; - QString found(namelist[n]->d_name); - - if (found!=".." && found!=".") { - entry=KURL((*(QStringList::Iterator)resDirs.begin()) + found); - layout.append(entry); - - free(namelist[n]); - // kdDebug(126) << "Entry: " << entry.prettyURL() << "\n"; - } - } - free(namelist); - - // Copy CD template to konqueror-selected folders. - job=KIO::copy(layout,base); - // After copy is finished, start creating the indexes. - connect(job,SIGNAL(result(KIO::Job *)),SLOT(createIndexes())); + QDir templateDir(resDirs[0],QString::null,QDir::Files | QDir::Readable); + QStringList templateFiles = templateDir.entryList(); + for (QStringList::ConstIterator i = templateFiles.begin() ; + i != templateFiles.end(); + ++i) + { + kdDebug() << *i << endl; + // Might need to prepend the dirname, too, in + // which case use templateDir::path()+(*i) + layout.append(KURL(*i)); } + // Copy CD template to konqueror-selected folders. + job=KIO::copy(layout,base); + // After copy is finished, start creating the indexes. + connect(job,SIGNAL(result(KIO::Job *)),SLOT(createIndexes())); } --Boundary-00=_ANaE/Hya9G0eclI Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --Boundary-00=_ANaE/Hya9G0eclI--