Fixed: "KeepassX 0.3.3 fails to lock itself after Ctrl-V (autotype)" (Bug #2106604)

Clear Klipper history on KDE4

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@230 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 16 years ago
parent f533ea45a7
commit a8fafee769
  1. 4
      share/applications/keepassx.desktop
  2. 4
      share/mimelnk/application/x-keepass.desktop
  3. 4
      src/dialogs/AutoTypeDlg.cpp
  4. 3
      src/dialogs/AutoTypeDlg.h
  5. 2
      src/lib/AutoType.h
  6. 25
      src/lib/AutoType_X11.cpp
  7. 13
      src/lib/EntryView.cpp

@ -3,7 +3,7 @@ Name=KeePassX
GenericName=Cross Platform Password Manager GenericName=Cross Platform Password Manager
GenericName[de]=Passwortverwaltung GenericName[de]=Passwortverwaltung
GenericName[fr]=Gestionnaire de mot de passe GenericName[fr]=Gestionnaire de mot de passe
Exec=keepassx Exec=keepassx %f
Icon=keepassx Icon=keepassx
Comment=Cross Platform Password Manager Comment=Cross Platform Password Manager
Comment[de]=Passwortverwaltung Comment[de]=Passwortverwaltung
@ -11,4 +11,4 @@ Comment[fr]=Gestionnaire de mot de passe
Terminal=false Terminal=false
Type=Application Type=Application
Categories=Qt;Utility; Categories=Qt;Utility;
MimeType=application/x-keepass MimeType=application/x-keepass;

@ -3,6 +3,6 @@ Comment=KeePass database
Comment[de]=KeePass Datenbank Comment[de]=KeePass Datenbank
Hidden=false Hidden=false
Icon=keepassx Icon=keepassx
MimeType=application/x-keepass MimeType=application/x-keepass;
Patterns=*.kdb Patterns=*.kdb;
Type=MimeType Type=MimeType

@ -19,7 +19,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include "AutoTypeDlg.h" #include "AutoTypeDlg.h"
AutoTypeDlg::AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers){ AutoTypeDlg::AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers, bool wasLocked) : pWasLocked(wasLocked){
setupUi(this); setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
@ -101,5 +101,5 @@ bool AutoTypeDlg::event(QEvent* event){
void AutoTypeDlg::itemSelected(QTreeWidgetItem* item){ void AutoTypeDlg::itemSelected(QTreeWidgetItem* item){
close(); close();
QString err; QString err;
AutoType::perform(itemToEntry[item].dbHandle,err,false,itemToEntry[item].nr); AutoType::perform(itemToEntry[item].dbHandle, err, pWasLocked, itemToEntry[item].nr, pWasLocked);
} }

@ -24,7 +24,7 @@ class AutoTypeDlg : public QWidget, private Ui::AutoTypeDlg
Q_OBJECT Q_OBJECT
public: public:
AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers); AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers, bool wasLocked);
protected: protected:
void paintEvent(QPaintEvent* event); void paintEvent(QPaintEvent* event);
@ -42,4 +42,5 @@ class AutoTypeDlg : public QWidget, private Ui::AutoTypeDlg
static bool itemLessThan(QTreeWidgetItem* i1, QTreeWidgetItem* i2); static bool itemLessThan(QTreeWidgetItem* i1, QTreeWidgetItem* i2);
QHash<QTreeWidgetItem*,AutoTypeEntry> itemToEntry; QHash<QTreeWidgetItem*,AutoTypeEntry> itemToEntry;
QPixmap BannerPixmap; QPixmap BannerPixmap;
bool pWasLocked;
}; };

@ -34,7 +34,7 @@ class KeepassMainWindow;
class AutoType{ class AutoType{
public: public:
static KeepassMainWindow* MainWin; static KeepassMainWindow* MainWin;
static void perform(IEntryHandle* entry, QString& err,bool hideWindow=true,int nr=0); static void perform(IEntryHandle* entry, QString& err,bool hideWindow=true,int nr=0,bool wasLocked=false);
#ifdef GLOBAL_AUTOTYPE #ifdef GLOBAL_AUTOTYPE
static Shortcut shortcut; static Shortcut shortcut;
static void performGlobal(); static void performGlobal();

@ -55,7 +55,7 @@ KeepassMainWindow* AutoType::MainWin=NULL;
Shortcut AutoType::shortcut; Shortcut AutoType::shortcut;
#endif #endif
void AutoType::perform(IEntryHandle* entry, QString& err,bool hideWindow,int nr){ void AutoType::perform(IEntryHandle* entry, QString& err,bool hideWindow,int nr,bool wasLocked){
QString indexStr; QString indexStr;
if (nr==0) if (nr==0)
indexStr = "Auto-Type:"; indexStr = "Auto-Type:";
@ -154,8 +154,20 @@ void AutoType::perform(IEntryHandle* entry, QString& err,bool hideWindow,int nr)
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),false,0); XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),false,0);
} }
if (hideWindow && !(config->showSysTrayIcon() && config->minimizeTray()) ) if (config->lockOnMinimize()){
MainWin->showMinimized(); if (hideWindow || wasLocked){
if ( !(config->showSysTrayIcon() && config->minimizeTray()) )
MainWin->showMinimized();
else
MainWin->OnUnLockWorkspace();
}
}
else{
if (hideWindow && !(config->showSysTrayIcon() && config->minimizeTray()) )
MainWin->showMinimized();
if (wasLocked)
MainWin->OnUnLockWorkspace();
}
} }
#ifdef GLOBAL_AUTOTYPE #ifdef GLOBAL_AUTOTYPE
@ -230,7 +242,8 @@ QStringList AutoType::getAllWindowTitles(){
} }
void AutoType::performGlobal(){ void AutoType::performGlobal(){
if (MainWin->isLocked()) bool wasLocked = MainWin->isLocked();
if (wasLocked)
MainWin->OnUnLockWorkspace(); MainWin->OnUnLockWorkspace();
if (!MainWin->isOpened()) if (!MainWin->isOpened())
@ -334,10 +347,10 @@ void AutoType::performGlobal(){
if (validEntries.size()==1){ if (validEntries.size()==1){
QString err; QString err;
perform(validEntries[0],err,false,entryNumbers[0]); perform(validEntries[0],err,wasLocked,entryNumbers[0],wasLocked);
} }
else if (validEntries.size()>1){ else if (validEntries.size()>1){
AutoTypeDlg* dlg = new AutoTypeDlg(validEntries, entryNumbers); AutoTypeDlg* dlg = new AutoTypeDlg(validEntries, entryNumbers, wasLocked);
dlg->show(); dlg->show();
} }
} }

@ -322,10 +322,17 @@ void KeepassEntryView::OnClipboardTimeOut(){
Clipboard->clear(QClipboard::Selection); Clipboard->clear(QClipboard::Selection);
} }
#ifdef Q_WS_X11 #ifdef Q_WS_X11
static bool clearKlipper = true; static bool clearKlipper3 = true;
if (clearKlipper){ static bool clearKlipper4 = true;
if (clearKlipper3){
if (QProcess::execute("dcop klipper klipper clearClipboardHistory")!=0) if (QProcess::execute("dcop klipper klipper clearClipboardHistory")!=0)
clearKlipper = false; clearKlipper3 = false;
}
if (clearKlipper4){
if (QProcess::execute("dbus-send --type=method_call --print-reply --dest=org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory")!=0)
clearKlipper4 = false;
} }
#endif #endif
} }