[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Release: Music Manager Konqueror Plugin
From:       Adriaan de Groot <adridg () cs ! kun ! nl>
Date:       2003-07-13 18:21:52
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Avi,

It took a little wrestling to get musicman to compile - like Aaron pointed 
out, there are some #includes missing (system and library headers are 
notoriously difficult to get to work properly; I needed to add stdlib.h for 
free() and math.h for floor()). There's also some bmake problems with .ui 
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, 
and it worked. At least, the menu entries are added for .mp3 files, and I can 
call up the create CD cover function (with empty list boxes because of the 
missing templates).

I'm slightly surprised it does nothing for .oggs. Do you just not have any 
oggs in your collection? 

Attached, please find the diff to change from scandir() to QDir in one place 
(there's three in musicindexgenerator.cpp). I couldn't test it, because of 
the uninstalled templates + I don't know how to get on that code path, but it 
does compile. I hope it illustrates sufficiently how the QDir API can be used 
and that it's simpler than scandir(). 


- -- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot@kde.org>
     Key fingerprint = 934E 31AA 80A7 723F 54F9  50ED 76AC EE01 FEA2 A3FE
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE/EaNAdqzuAf6io/4RAvF0AJ48m+XazPnOz0DqYajDV6LinocGPACgkDGu
zR/nWyLXd6o+otWTJoo90/Y=
=ddt7
-----END PGP SIGNATURE-----

["musicman.diff" (text/x-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()));
 }
 
 


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic