Nvu and KDE...
By glazou on Wednesday 8 December 2004, 21:49 - Nvu - Permalink
Moving Nvu to the Firefox 1.0 codebase led to a major problem if I want to integrate a bit more Nvu with Kde, for instance to use native KDE icons for mimetypes in the site manager : the application has to create a KApplication() to be able to resolve a mimetype. But the application shuts itself down and restarts when it creates the default profile for the first time or when it has to disable some existing extensions. Apparently, this does not live well with KApplication() and I wonder if I won't have to drop, unfortunately, that feature. Help on this topic highly welcomed, if you can provide some.

Comments
Where does it initialize the KApplication? I bet that if we move the KApplication-init into nsAppRunner.cpp that this problem will go away. (Put it somewhere near the current call to gtk_init).
to make simple, in main()... Init'ing KApplication requires argc and argv so it was a good spot
Why integrate with KDE?! Firefox and Thunderbird are going to be integrated with GNOME, so Nvu choosing KDE would be just totally incoherent with the rest of the "new" Mozilla apps...
Linspire is KDE-based, so KDE integration makes sense for an app being funded by Linspire.
@marcoos:
You might remember that NVu development is sponsored by Linspire and AFAIK Linspire is using KDE. So I can see why Daniel is trying to integrate with KDE.
I personally hope that all new Mozilla apps will integrate with both KDE and Gnome. I'm using KDE on Linux and if the new applications integratie with KDE its likely I continue using it.
It would be nice if KDE and Gnome are going to define some cross-desktop/WM protocols that can be used independant of the Toolkit used (either Qt/KDE or GTK)...
marcoos: Yes, you're completely right, why would any self-respecting KDE user want to use any of that stinky Moz software, right?? </sarcasm>
ANYWAYS, does changing KApplication to KInstance work? There are some parts of KDE that require only a KInstance to work properly so they can be used without a GUI, I believe KStandardDirs (that is what you're using, right?) can be used in this fashion.
The only problem is that I don't know how KInstance behaves upon an application restart, so the changes may be for naught anyways.
marcoos: as always i can't understand why you're loosing so much of Your energy on trying to dispirit anyone who is trying to work on Mozilla and KDE integration.
Perhaps Linspire would like to ship the Qt-port of Mozilla, when it's stable enough.
Getting OT here, but since we're talking about KDE/Mozilla... Does anyone know if the new Qt port just included Gecko, or did it include XUL and all the toolkit stuff? So, would it be possible to compile Firefox/Mozilla completely without GTK (and even have Qt-themed widgets)? I agree that integrating into both Gnome and KDE is a good thing.
There are zillions of KDE users out there, like it or not. From my perspective, I don't see why Mozilla should be more linked to Gnome than to any other system. Furthermore, from a KDE user's perspective, answering "too bad, our code is made for Gnome" is the worst possible answer.
Some KDE users use it only because their distro uses it. Or some have no choice because sitting in a corporate environment. Period. If you don't offer integration to KDE, they will have a user experience far below Gnome users experience, and that's bad for Mozilla. My 2 eurocents here.
Forgot to add that KDE has a URL->MimeType->Icon API available to all apps. I see no reason why Nvu running on a KDE-based system should not ALWAYS try to use it.
Daniel, have you tried to see with the people who worked on a KDE port of Mozilla at the aKademy ?
OK, I've made some sample code to load an icon from a mimetype using a KInstance instead of a KApplication, and it seems to work. It shows a QLabel to demonstrate the pixmap loading, but the QApplication stuff isn't required.
Again, I'm not sure how KInstance works across a program restart, but since it doesn't connect to the DCOP server I don't have any reason to think it would act up.
// You must also link with -lkio.
#include <qstring.h>
#include <qpixmap.h>
#include <qapplication.h>
#include <qlabel.h>
#include <kinstance.h>
#include <kmimetype.h>
#include <kiconloader.h>
#include <kaboutdata.h>
#include <kdebug.h>
int main(int argc, char *argv[])
{
char *mimetype = "image/jpeg";
// Create KInstance for use with KStandardDirs and
// KMimeType, etc.
(void) new KInstance("kdeicon-test");
if(argc > 1)
mimetype = argv[1];
// KMimeType::Ptr is a shared pointer wrapper that will automatically
// delete the KMimeType.
KMimeType::Ptr mimeType = KMimeType::mimeType(mimetype);
kdDebug() << "Filename for " << mimetype << " is " << mimeType->icon(QString(), false) << endl;
// The following is not required to use KMimeType, it is just there
// to demonstrate mimeType->pixmap()
QApplication a(argc, argv);
a.connect(&a, SIGNAL(lastWindowClosed()), SLOT(quit()));
QLabel *l = new QLabel(0);
l->setPixmap(mimeType->pixmap(KIcon::Desktop));
l->show();
a.setMainWidget(l);
return a.exec();
}
Cher Monsieur Glazman,
Je voulais vous signaler ce qui me paraît être un bogue aléatoire : l'image de fond n'est parfois pas rattachée au répertoire local ; ce n'est pas tout : lorsqu'on tâche d'y remédier, l'enregistrement n'a pas lieu. Il est nécessaire d'effacer le nom du fichier et de relancer la page et la procédure d'enregistrement d'une image de fond [système Windows Me].
Bien cordialement,
Hervé Delboy
Michael Pyne: I'll give it a try, thanks a lot!
Hervé Delboy: il faudrait penser à arrêter de poster des bugs reports dans des articles de ce blog n'ayant rien à voir. Il y a dans Nvu un menu exprès pour cela, merci de vous en servir...
Just wanted to add my voice to those who would appreciate support for KDE. If the Mozilla platform can support Mac, Windows, and Gnome guis then why not KDE as well?
All the Gnome-only snobs can go stuff it. :-P
> From my perspective, I don't see why Mozilla should be
> more linked to Gnome than to any other system.
Two reasons:
1) Companies that want to integrate closed-source code with Mozilla, on Linux, without paying money to Trolltech, need something that doesn't depend on Qt.
2) Companies that pay people to work on Mozilla favour GNOME.
But that doesn't stop people porting Gecko to Qt/KDE, and I'm very glad that such a port is happening.
> Just wanted to add my voice to those who would appreciate

> support for KDE.
We don't need your voice. We need your code
roc: Companies that pay me to work on Mozilla favour KDE