[PATCH] Show the clipboard history when pressing the Paste button

Andras Mantia amantia at kde.org
Wed Sep 24 20:49:22 BST 2003


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

On Wednesday 24 September 2003 19:43, David Faure wrote:
> On Wednesday 24 September 2003 18:15, Andras Mantia wrote:
> > +      if (klipper.send("setClipboardContents", m_popup->text(id)))
> > +        kdDebug(129) << "Clipboard: " << 
qApp->clipboard()->text(QClipboard::Clipboard) << endl;    
> > +    }
> > +    QTimer::singleShot(20, this, SLOT(slotActivated())); 
> 
> That's a very obvious race condition.
> You should use call() instead of send(), in order to be certain that klipper
> processed the call before using the clipboard. Then you don't need
> the QTimer::singleShot.
In the first (non-published) version I used "call" instead of "send". I don't 
know why I changed it to send. But what is sure that in that first version I 
also needed the singleShot, otherwise the selected text was not inserted. 
Well, I will test again.

> Mmm, if we have the text in memory why do we have to ask klipper to 
> set the clipboard? Because it can be a shortened version of the text?
> But then what happens if two texts have the same shortened version?
> (or does klipper prevent against that?)... OK, this paragraph is about
> something rather minor, you can ignore this :)
I don't know another way to select a text from the clipboard history. Klipper 
doesn't have a DCOP method which I can use to select the N-th item from the 
menu. 


> This action looks good to me, otherwise. I just hope it doesn't become
> the standard action for KStdAction::paste, because e.g. in a vector
> drawing application, seeing text contents to be pasted is totally useless.
First I wanted to write you that you're right, it doesn't make sense in all 
applications. But even in a vector drawing (or some other type of) 
application it may make sense to paste text into. Of course, the best would 
be if Klipper would notice non-text object in the clipboard and we could 
handle it in the same way.
 Anyway, if you don't want it to be the standard paste action, I just don't 
commit the patch to kstdaction.cpp.

Andras

> 
> -- 
> David Faure -- faure at kde.org, dfaure at klaralvdalens-datakonsult.se
> Qt/KDE/KOffice developer
> Klarälvdalens Datakonsult AB, Platform-independent software solutions
> 
> 
> 
> 
> 
> 

- -- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iD8DBQE/cfVETQdfac6L/08RAgCcAKCcNPso2LjB+BU/XSSW9t/DJ0eC0QCgwurY
axz8LaSmK1W1JNJJKRVDrt4=
=O1j0
-----END PGP SIGNATURE-----




More information about the kde-core-devel mailing list