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
This commit is contained in:
parent
2149d4cfe1
commit
619eaa1552
|
@ -25,11 +25,18 @@ KeepassApplication::KeepassApplication(int& argc, char** argv) : QApplication(ar
|
|||
}
|
||||
|
||||
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;
|
||||
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();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return QApplication::x11EventFilter(event);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class KeepassApplication : public QApplication
|
|||
public:
|
||||
KeepassApplication(int& argc, char** argv);
|
||||
bool x11EventFilter(XEvent* event);
|
||||
static bool x11KeyEvent(XEvent* event);
|
||||
};
|
||||
|
||||
#endif // APPLICATION_X11_H
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
class GnomePlugin:public QObject,public IFileDialog,public IGnomeInit{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(IFileDialog)
|
||||
Q_INTERFACES(IGnomeInit)
|
||||
Q_INTERFACES(IFileDialog);
|
||||
Q_INTERFACES(IGnomeInit);
|
||||
public:
|
||||
virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir,
|
||||
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"),
|
||||
ki18n("Cross Platform Password Manager"));
|
||||
createIconMap();
|
||||
#ifdef GLOBAL_AUTOTYPE
|
||||
return dynamic_cast<QApplication*>( new KpKApplication() );
|
||||
#else
|
||||
return dynamic_cast<QApplication*>( new KApplication() );
|
||||
#emdif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
class KdePlugin:public QObject,public IFileDialog,public IKdeInit,public IIconTheme{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(IFileDialog)
|
||||
Q_INTERFACES(IKdeInit)
|
||||
Q_INTERFACES(IIconTheme)
|
||||
Q_INTERFACES(IFileDialog);
|
||||
Q_INTERFACES(IKdeInit);
|
||||
Q_INTERFACES(IIconTheme);
|
||||
public:
|
||||
virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir,
|
||||
QStringList Filters, int SelectedFilter);
|
||||
|
|
|
@ -6,6 +6,10 @@ TEMPLATE = lib
|
|||
CONFIG += plugin release
|
||||
HEADERS += keepassx-kde.h
|
||||
SOURCES += keepassx-kde.cpp
|
||||
contains(DEFINES,GLOBAL_AUTOTYPE) {
|
||||
HEADERS += KpKApplication.h
|
||||
SOURCES += KpKApplication.cpp
|
||||
}
|
||||
MOC_DIR = ../../../build/moc
|
||||
OBJECTS_DIR = ../../../build
|
||||
TARGET = ../../../lib/keepassx-kde
|
||||
|
|
Loading…
Reference in New Issue