fmoralesc / pastie

a simple *nix clipboard manager with application-indicator support
45 stars 7 forks source link

KeepassX + pastie #19

Closed tfmoraes closed 13 years ago

tfmoraes commented 13 years ago

in KeepassX there is a feature which I can copy a password to the clipboard, then I can paste in some form, after some seconds KeepassX deletes it from the clipboard, so I can't paste that anymore. But with pastie it doesn't works, I tried with klipper and it works.

fmoralesc commented 13 years ago

It seems that Keepasx sends a signal to klipper to inform it should delete the item:

    keepassx-0.4.3/lib/EntryView.cpp:481-491

void KeepassEntryView::OnClipboardTimeOut(){
    Clipboard->clear(QClipboard::Clipboard);
    if(Clipboard->supportsSelection()){
        Clipboard->clear(QClipboard::Selection);
    }
#ifdef Q_WS_X11
    QProcess::startDetached("dcop klipper klipper clearClipboardHistory");
    QProcess::startDetached("dbus-send --type=method_call --dest=org.kde.klipper /klipper "
        "org.kde.klipper.klipper.clearClipboardHistory");
#endif
}

Should pastie hijack klipper dbus interface? What's the best approach here?

fmoralesc commented 13 years ago

BTW: this means Keepassx wouldn't work in any clipboard manager, except klipper.

tfmoraes commented 13 years ago

Hi. I don't know, I don't have any experience with dbus. I think the best is contact klipper and KeepassX developers to create a more generic dbus interface. The easy way is hijack klipper dbus interface.

fmoralesc commented 13 years ago

I proposed KeePassX to set a special target for passing the timeout value to the clipboard manager, so it handles by itself the deletion. This would need no use of DBus. https://sourceforge.net/tracker/index.php?func=detail&aid=3061597&group_id=166631&atid=839779

fmoralesc commented 13 years ago

I've coded a hack for keepassx implementing the change described in the SF bug. To build a patched keepassx version in ubuntu 10.04, in a terminal:

mkdir keepassx-build && cd keepassx-build
apt-get source keepassx
cd keepassx-0.4.3/src/lib/
wget http://github.com/downloads/fmoralesc/pastie/EntryView.diff
patch -R EntryView.cpp EntryView.diff
cd ../..
cmake CMakeLists.txt
make

and then, you can run it using

./src/keepassx
fmoralesc commented 13 years ago

I included a way to handle this patch into pasties testing branch. It will only work if the password remains the last text copied into the clipboard, though.

tfmoraes commented 13 years ago

I'm going to test your patch this night, I'm far from a Linux desktop.

fmoralesc commented 13 years ago

OK. That will give me time to work on the code so pastie deletes the password no matter which position it is in the history.

tfmoraes commented 13 years ago

It's working! Thanks, great work!

fmoralesc commented 13 years ago

I still have to sort out that last thing I mentioned, so be careful ;) The changes are included already in the 0.6.7.1 version in the PPA.