Skip to main content

Ralsina.Me — Roberto Alsina's website

Drag and Drop in KRsN

Work­ing pret­ty well now. It's not saved for fol­low­ing ses­sion­s, and the fold­ers don't do what I want (show an ag­gre­gate of their in­ner feed­s) yet, but it was pret­ty easy.

Confused by QMimeSourceFactory

Ok, here it goes. If you are not flu­ent in Qt pro­gram­ming the fol­low­ing en­try will make no sense what­so­ev­er :-)

If you set the con­tents of a QTextBrowser, and the con­tent is HTM­L, it will call its QMime­Source­Fac­to­ry's data() method to get MimeOb­jects rep­re­sent­ing, for ex­am­ple, im­ages in the HTM­L.

So far so good.

How­ev­er, I am mist­i­fied by this: While it's do­ing that, you can change the con­tents, and it will go along it's mer­ry way, ex­cept that old data() calls are still in progress.

In oth­er word­s, it acts as if it's mul­ti­thread­ed. Usu­al­ly, in Qt, this is be­cause some­one is call­ing QAp­p::pro­ces­sEv­ents, and then you have mul­ti­ple func­tions run­ning and yield­ing to each oth­er in the Qt event loop.

That is sure­ly what's hap­pene­ing, but... how the hell does one stop the old data() call­s????

The pro­ces­sEv­ents call is not made by me, it's done in­ter­nal­ly by some method in the QTextBrows­er.... so, right now, in KRsN, some­times you are down­load­ing im­ages for old stuff you saw min­utes ago!

Qmail RPMs

I have been us­ing Bruce Guenter's nice Qmail rpms for years, but he does­n't seem to be work­ing on them much.

So, I just fixed a cou­ple of is­sues:

  • TLS Sup­­port

  • er­rno fix (for glibc 2.3)

  • svc-add smt­pd (sil­­ly)

So, it now builds out­-of-the-box on RH8 and RH9.

I should open a site for them, prob­a­bly. Add CRAM-MD5 au­then­ti­ca­tion (I have it work­ing with a plain file, LDAP would be nicer), a work­ing couri­er RPM (tricky to build some­times), a lit­tle ex­tra stuff (an­tivirus, spa­mas­sas­s­in, au­tore­spon­der) and it's re­al­ly a nice mail serv­er in a box.

Shopping spree

A mod­est one, though. I got a 802.11b card, and a nice USB stor­age thingie. Nice toys, should be use­ful, too.

Cod­ing in KRsN is quite nice­ly mov­ing for­ward. The de­sign of the app is al­most com­pe­tent now, and it works well (a cou­ple sil­ly mis­takes I just fixed had bro­ken feed ad­di­tion, though)

Post-facto inheritance

Now, I did­n't ex­pect this to work at al­l!

A QlistView is a sort of tree wid­get, and is drag&­drop en­abled.

The trick is, you have to reim­ple­ment dragOb­jec­t() so it re­turns a drag­gable thingie af­ter you drag some­thing.

But, since I am us­ing de­sign­er to draw the form­s, I have to use a re­al QListView, not a child class.

Co­nun­drum? Cus­tom wid­get in de­sign­er? Not with python!

def myDragObject(self):

re­turn QTextDrag("­some­thing",­self)


And that work­s! I know it should work in python, but QListView is im­ple­ment­ed in a C++ mod­ule!

The guys that did PyQt re­al­ly made it well.

Contents © 2000-2023 Roberto Alsina