Global auto-type now works when using the kde plugin

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@156 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent 2149d4cfe1
commit 619eaa1552
  1. 9
      src/Application_X11.cpp
  2. 1
      src/Application_X11.h
  3. 4
      src/plugins/gnome/keepassx-gnome.h
  4. 31
      src/plugins/kde/KpKApplication.cpp
  5. 34
      src/plugins/kde/KpKApplication.h
  6. 4
      src/plugins/kde/keepassx-kde.cpp
  7. 6
      src/plugins/kde/keepassx-kde.h
  8. 4
      src/plugins/kde/keepassx-kde.pro

@ -25,11 +25,18 @@ KeepassApplication::KeepassApplication(int& argc, char** argv) : QApplication(ar
} }
bool KeepassApplication::x11EventFilter(XEvent* event){ bool KeepassApplication::x11EventFilter(XEvent* event){
if (x11KeyEvent(event))
return true;
else
return QApplication::x11EventFilter(event);
}
bool KeepassApplication::x11KeyEvent(XEvent* event){
static const unsigned int remove_invalid = ControlMask|ShiftMask|Mod1Mask|Mod5Mask|Mod4Mask; static const unsigned int remove_invalid = ControlMask|ShiftMask|Mod1Mask|Mod5Mask|Mod4Mask;
if (event->type==KeyPress && AutoType::shortcut.key!=0u && event->xkey.keycode==XKeysymToKeycode(event->xkey.display,HelperX11::getKeysym(AutoType::shortcut.key)) && (event->xkey.state&remove_invalid)==HelperX11::getShortcutModifierMask(AutoType::shortcut) && QApplication::focusWidget()==NULL ){ if (event->type==KeyPress && AutoType::shortcut.key!=0u && event->xkey.keycode==XKeysymToKeycode(event->xkey.display,HelperX11::getKeysym(AutoType::shortcut.key)) && (event->xkey.state&remove_invalid)==HelperX11::getShortcutModifierMask(AutoType::shortcut) && QApplication::focusWidget()==NULL ){
AutoType::performGlobal(); AutoType::performGlobal();
return true; return true;
} }
else else
return QApplication::x11EventFilter(event); return false;
} }

@ -29,6 +29,7 @@ class KeepassApplication : public QApplication
public: public:
KeepassApplication(int& argc, char** argv); KeepassApplication(int& argc, char** argv);
bool x11EventFilter(XEvent* event); bool x11EventFilter(XEvent* event);
static bool x11KeyEvent(XEvent* event);
}; };
#endif // APPLICATION_X11_H #endif // APPLICATION_X11_H

@ -27,8 +27,8 @@
class GnomePlugin:public QObject,public IFileDialog,public IGnomeInit{ class GnomePlugin:public QObject,public IFileDialog,public IGnomeInit{
Q_OBJECT Q_OBJECT
Q_INTERFACES(IFileDialog) Q_INTERFACES(IFileDialog);
Q_INTERFACES(IGnomeInit) Q_INTERFACES(IGnomeInit);
public: public:
virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir, virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir,
QStringList Filters); QStringList Filters);

@ -0,0 +1,31 @@
/***************************************************************************
* Copyright (C) 2005-2008 by Felix Geyer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "KpKApplication.h"
#include "Application_X11.h"
KpKApplication::KpKApplication() : KApplication(){
}
bool KeepassApplication::x11EventFilter(XEvent* event){
if (KeepassApplication::x11KeyEvent(event))
return true;
else
return KApplication::x11EventFilter(event);
}

@ -0,0 +1,34 @@
/***************************************************************************
* Copyright (C) 2005-2008 by Felix Geyer *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; version 2 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef KP_KAPPLICATION_H
#define KP_KAPPLICATION_H
#include <kapplication.h>
class KpKApplication : public KApplication
{
Q_OBJECT
public:
KpKApplication();
bool x11EventFilter(XEvent* event);
};
#endif // KP_KAPPLICATION_H

@ -153,7 +153,11 @@ QApplication* KdePlugin::getMainAppObject(int argc, char** argv){
QByteArray("0.2.3"), QByteArray("0.2.3"),
ki18n("Cross Platform Password Manager")); ki18n("Cross Platform Password Manager"));
createIconMap(); createIconMap();
#ifdef GLOBAL_AUTOTYPE
return dynamic_cast<QApplication*>( new KpKApplication() );
#else
return dynamic_cast<QApplication*>( new KApplication() ); return dynamic_cast<QApplication*>( new KApplication() );
#emdif
} }

@ -28,9 +28,9 @@
class KdePlugin:public QObject,public IFileDialog,public IKdeInit,public IIconTheme{ class KdePlugin:public QObject,public IFileDialog,public IKdeInit,public IIconTheme{
Q_OBJECT Q_OBJECT
Q_INTERFACES(IFileDialog) Q_INTERFACES(IFileDialog);
Q_INTERFACES(IKdeInit) Q_INTERFACES(IKdeInit);
Q_INTERFACES(IIconTheme) Q_INTERFACES(IIconTheme);
public: public:
virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir, virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir,
QStringList Filters, int SelectedFilter); QStringList Filters, int SelectedFilter);

@ -6,6 +6,10 @@ TEMPLATE = lib
CONFIG += plugin release CONFIG += plugin release
HEADERS += keepassx-kde.h HEADERS += keepassx-kde.h
SOURCES += keepassx-kde.cpp SOURCES += keepassx-kde.cpp
contains(DEFINES,GLOBAL_AUTOTYPE) {
HEADERS += KpKApplication.h
SOURCES += KpKApplication.cpp
}
MOC_DIR = ../../../build/moc MOC_DIR = ../../../build/moc
OBJECTS_DIR = ../../../build OBJECTS_DIR = ../../../build
TARGET = ../../../lib/keepassx-kde TARGET = ../../../lib/keepassx-kde