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

David Faure dfaure at klaralvdalens-datakonsult.se
Wed Sep 24 17:43:20 BST 2003


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.

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 :)

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.

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




More information about the kde-core-devel mailing list