auto-type delays

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@137 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
tarek_saidi 2007-07-01 12:03:45 +00:00
parent 276939290d
commit c2554f30f0
19 changed files with 8635 additions and 2826 deletions

View File

@ -2,7 +2,7 @@
min-height: 120px;
height: auto !important;
height: 120px;
background-image: url('../images/headerbackground.png');
background-image: url('./images/headerbackground.png');
background-repeat: repeat-x;
padding: 0 25px 15px 25px;
padding: 0;
@ -12,7 +12,7 @@
min-height: 120px;
height: auto !important;
height: 120px;
background-image: url('../images/logo.png');
background-image: url('./images/logo.png');
padding: 0 25px 15px 25px;
background-repeat: no-repeat;
padding: 0;

View File

@ -1,13 +1,110 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>KeePassX</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<div id="wrapheader">
<div id="logo"/>
</div>
<h1>Introduction</h1><br/>
- to be written -
</body>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>KeePassX User Guide</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="NEXT"
TITLE="Introduction"
HREF="f3.html"></HEAD
><BODY
CLASS="book"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="BOOK"
><A
NAME="basic_usage"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
><A
NAME="basic_usage"
>KeePassX User Guide</A
></H1
><HR></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="f3.html"
>Introduction</A
></DT
><DT
>1. <A
HREF="c15.html"
>First Steps</A
></DT
><DT
>2. <A
HREF="c18.html"
></A
></DT
></DL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="f3.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Introduction</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View File

@ -89,6 +89,8 @@ public:
QString urlCmd(){return settings.value("Options/UrlCmd").toString();}
QByteArray vSplitterPos(){return settings.value("UI/VSplitterPos").toByteArray();}
bool askBeforeDelete(){return settings.value("Options/AskBeforeDelete",true).toBool();}
int autoTypePreGap(){return settings.value("Options/AutoTypePreGap",500).toInt();}
int autoTypeKeyStrokeDelay(){return settings.value("Options/AutoTypeKeyStrokeDelay",0).toInt();}
void setAlternatingRowColors(bool value){settings.setValue("Options/AlternatingRowColors",value);}
void setBannerColor1(const QColor& value){settings.setValue("Options/BannerColor1",colorToString(value));}
@ -130,6 +132,8 @@ public:
void setUrlCmd(const QString& value){settings.setValue("Options/UrlCmd",value);}
void setVSplitterPos(const QByteArray& value){settings.setValue("UI/VSplitterPos",value);}
void setAskBeforeDelete(bool value){settings.setValue("Options/AskBeforeDelete",value);}
void setAutoTypePreGap(int value){settings.setValue("Options/AutoTypePreGap",value);}
void setAutoTypeKeyStrokeDelay(int value){settings.setValue("Options/AutoTypeKeyStrokeDelay",value);}
unsigned fileDlgHistorySize();
void clearFileDlgHistory(){settings.remove("FileDlgHistory");};

View File

@ -81,6 +81,7 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
Check_CollectOncePerSession->setChecked(pwGenOptions.at(9));
OnRadio1StateChanged(pwGenOptions.at(0));
OnRadio2StateChanged(!pwGenOptions.at(0));
Spin_Num->setValue(config->pwGenLength());
}
CGenPwDialog::~CGenPwDialog(){
@ -96,6 +97,7 @@ CGenPwDialog::~CGenPwDialog(){
pwGenOptions.setBit(8,Check_CollectEntropy->isChecked());
pwGenOptions.setBit(9,Check_CollectOncePerSession->isChecked());
config->setPwGenOptions(pwGenOptions);
config->setPwGenLength(Spin_Num->value());
}
void CGenPwDialog::paintEvent(QPaintEvent *event){

View File

@ -30,6 +30,7 @@
#include <QPainter>
#include "SettingsDlg.h"
#include "CustomizeDetailViewDlg.h"
#include "FileDialogs.h"
bool CSettingsDlg::PluginsModified=false;
@ -41,6 +42,7 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
connect(DialogButtons, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
connect(DialogButtons, SIGNAL( clicked(QAbstractButton*)), this, SLOT(OnOtherButton(QAbstractButton*)));
connect(Button_ClearFileDlgHistory, SIGNAL(clicked()), &fileDlgHistory, SLOT(clear()));
connect(ButtonColor1, SIGNAL( clicked() ), this, SLOT( OnColor1() ) );
connect(ButtonColor2, SIGNAL( clicked() ), this, SLOT( OnColor2() ) );
connect(ButtonTextColor, SIGNAL( clicked() ), this, SLOT( OnTextColor() ) );
@ -138,7 +140,8 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
Edit_MountDir->setText(config->mountDir());
CheckBox_SaveRelativePaths->setChecked(config->saveRelativePaths());
SpinBox_AutoTypePreGap->setValue(config->autoTypePreGap());
SpinBox_AutoTypeKeyStrokeDelay->setValue(config->autoTypeKeyStrokeDelay());
}
CSettingsDlg::~CSettingsDlg()
@ -217,6 +220,8 @@ void CSettingsDlg::apply(){
if(CheckBox_BrowserDefault->isChecked())config->setUrlCmd(QString());
else config->setUrlCmd(Edit_BrowserCmd->text());
config->setSaveRelativePaths(CheckBox_SaveRelativePaths->isChecked());
config->setAutoTypePreGap(SpinBox_AutoTypePreGap->value());
config->setAutoTypeKeyStrokeDelay(SpinBox_AutoTypeKeyStrokeDelay->value());
}

View File

@ -157,6 +157,7 @@
<addaction name="menuImport" />
<addaction name="menuExport" />
<addaction name="separator" />
<addaction name="FileUnLockWorkspaceAction" />
<addaction name="FileExitAction" />
</widget>
<widget class="QMenu" name="menuBearbeiten" >
@ -544,6 +545,11 @@
<string>Recycle Bin...</string>
</property>
</action>
<action name="FileUnLockWorkspaceAction" >
<property name="text" >
<string>Lock Workspace</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -1060,7 +1060,7 @@
<number>6</number>
</property>
<item row="0" column="1" >
<widget class="QSpinBox" name="spinBox_PreGap" >
<widget class="QSpinBox" name="SpinBox_AutoTypePreGap" >
<property name="whatsThis" >
<string>Time between the activation of an auto-type action by the user and the first simulated key stroke.</string>
</property>
@ -1106,7 +1106,7 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="spinBox_KeyStrokeDelay" >
<widget class="QSpinBox" name="SpinBox_AutoTypeKeyStrokeDelay" >
<property name="whatsThis" >
<string>Delay between two simulated key strokes. Increase this if Auto-Type is randomly skipping characters.</string>
</property>

View File

@ -18,12 +18,14 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "KpxConfig.h"
#include <QApplication>
#include "AutoType.h"
#include <QTime>
#include <QList>
#include <QChar>
QWidget* AutoType::MainWin=NULL;
@ -64,11 +66,19 @@ void AutoType::pressModifiers(Display* d,int mods,bool press){
}
}
void AutoType::perform(IEntryHandle* entry, QString& err){
void sleepKeyStrokeDelay(){
if(config->autoTypeKeyStrokeDelay()==0)return;
struct timespec timeOut,remains;
timeOut.tv_sec = 0;
timeOut.tv_nsec = 30000000; /* 300 milliseconds */
timeOut.tv_nsec = config->autoTypeKeyStrokeDelay()*100000;
nanosleep(&timeOut, &remains);
}
void AutoType::perform(IEntryHandle* entry, QString& err){
struct timespec timeOut,remains;
timeOut.tv_sec = 0;
timeOut.tv_nsec = config->autoTypePreGap()*100000;
for(int i=0;i<10;i++)nanosleep(&timeOut, &remains);
QString str;
@ -119,9 +129,13 @@ void AutoType::pressModifiers(Display* d,int mods,bool press){
int keycode=XKeysymToKeycode(pDisplay,Keys[i]);
int mods=getModifiers(pDisplay,Keys[i],keycode);
pressModifiers(pDisplay,mods);
sleepKeyStrokeDelay();
XTestFakeKeyEvent(pDisplay,keycode,True,0);
sleepKeyStrokeDelay();
XTestFakeKeyEvent(pDisplay,keycode,False,1);
sleepKeyStrokeDelay();
releaseModifiers(pDisplay,mods);
sleepKeyStrokeDelay();
}
XCloseDisplay(pDisplay);
MainWin->show();

View File

@ -135,36 +135,32 @@ void FileDlgHistory::set(const QString& name,const QString& dir, int filter){
}
void FileDlgHistory::save(){
if(config->saveFileDlgHistory()){
//settings->beginGroup("FileDlgHistory");
for(unsigned i=0;i<static_cast<unsigned>(History.size());i++){
QStringList entry;
entry << History.keys().at(i)
<< History.values().at(i).Dir
<< QString::number(History.values().at(i).Filter);
//settings->setValue(QString("ENTRY%1").arg(i),QVariant(entry));
config->setFileDlgHistory(i,entry);
}
//settings->endGroup();
}
}
void FileDlgHistory::load(){
if(config->saveFileDlgHistory()){
//settings->beginGroup("FileDlgHistory");
//QStringList keys=settings->childKeys();
unsigned count=config->fileDlgHistorySize();
for(unsigned i=0;i</*keys.size()*/count;i++){
Entry entry;
QStringList value=config->fileDlgHistory(i);//settings->value(QString("ENTRY%1").arg(i)).toStringList();
QStringList value=config->fileDlgHistory(i);
entry.Dir=value[1];
entry.Filter=value[2].toInt();
History[value[0]]=entry;
}
//settings->endGroup();
}
else{
else
config->clearFileDlgHistory();
//settings->remove("FileDlgHistory");
}
}
void FileDlgHistory::clear(){
History=QHash<QString,Entry>();
config->clearFileDlgHistory();
}

View File

@ -27,13 +27,16 @@
#include "plugins/interfaces/IFileDialog.h"
class FileDlgHistory{
class FileDlgHistory:public QObject{
Q_OBJECT
public:
QString getDir(const QString& name);
int getFilter(const QString& name);
public slots:
void set(const QString& name,const QString& dir,int filter);
void save();
void load();
void clear();
private:
class Entry{
public:

View File

@ -38,6 +38,7 @@
#include <QFileDialog>
#include <QStatusBar>
#include "KpxFirefox.h"
#include "lib/random.h"
#include "lib/AutoType.h"
@ -94,6 +95,13 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
statusBar()->addWidget(StatusBarGeneral,15);
statusBar()->addWidget(StatusBarSelection,85);
statusBar()->setVisible(config->showStatusbar());
NormalCentralWidget=QMainWindow::centralWidget();
LockedCentralWidget=new QWidget(this);
WorkspaceLockedWidget.setupUi(LockedCentralWidget);
LockedCentralWidget->setVisible(false);
IsLocked=false;
setupConnections();
FileOpen=false;
@ -106,6 +114,8 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
else
config->setLastFile(QString());
}
HelpBrowser = new QAssistantClient(QString(),this);
HelpBrowser->setArguments(QStringList()<< "-profile" << "/home/tarek/Documents/KeePassX/share/keepass/doc/keepassx.adp");
// DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine
/*
@ -132,6 +142,7 @@ void KeepassMainWindow::setupConnections(){
connect(FileSettingsAction, SIGNAL(triggered()), this, SLOT(OnFileSettings()));
connect(FileChangeKeyAction, SIGNAL(triggered()), this, SLOT(OnFileChangeKey()));
connect(FileExitAction, SIGNAL(triggered()), this, SLOT(OnFileExit()));
connect(FileUnLockWorkspaceAction,SIGNAL(triggered()), this, SLOT(OnUnLockWorkspace()));
connect(menuImport,SIGNAL(triggered(QAction*)),this,SLOT(OnImport(QAction*)));
connect(menuExport,SIGNAL(triggered(QAction*)),this,SLOT(OnExport(QAction*)));
@ -183,6 +194,8 @@ void KeepassMainWindow::setupConnections(){
connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));
connect(DetailView,SIGNAL(anchorClicked(const QUrl&)),this,SLOT(OnDetailViewUrlClicked(const QUrl&)));
connect(WorkspaceLockedWidget.Button_Unlock,SIGNAL(clicked()),this,SLOT(OnUnLockWorkspace()));
connect(WorkspaceLockedWidget.Button_CloseDatabase,SIGNAL(clicked()),this,SLOT(OnFileClose()));
}
void KeepassMainWindow::setupToolbar(){
@ -877,7 +890,9 @@ dlg.exec();
}
void KeepassMainWindow::OnHelpHandbook(){
openBrowser(AppDir+"/../share/doc/keepass/index.html");
HelpBrowser->openAssistant();
}
void KeepassMainWindow::OnViewShowToolbar(bool show){
@ -984,3 +999,18 @@ void KeepassMainWindow::OnDetailViewUrlClicked(const QUrl& url){
openBrowser(url.toString());
}
void KeepassMainWindow::OnUnLockWorkspace(){
if(IsLocked){
LockedCentralWidget->setVisible(false);
LockedCentralWidget->setParent(NULL);
setCentralWidget(NormalCentralWidget);
NormalCentralWidget->setVisible(true);
IsLocked=false;
} else {
NormalCentralWidget->setVisible(false);
NormalCentralWidget->setParent(NULL);
setCentralWidget(LockedCentralWidget);
LockedCentralWidget->setVisible(true);
IsLocked=true;
}
}

View File

@ -38,6 +38,7 @@
#include <QTimer>
#include <QToolButton>
#include <QSystemTrayIcon>
#include <QAssistantClient>
#include <QUrl>
#include "Kdb3Database.h"
@ -47,6 +48,7 @@
#include "export/Export.h"
#include "ui_MainWindow.h"
#include "ui_WorkspaceLockedWidget.h"
class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
Q_OBJECT
@ -94,12 +96,14 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void OnImport(QAction*);
void OnExport(QAction*);
void OnDetailViewUrlClicked(const QUrl& url);
void OnUnLockWorkspace();
private:
void closeEvent(QCloseEvent* event);
SelectionState GroupSelection, EntrySelection;
bool FileOpen;
bool ModFlag;
bool IsLocked;
QList<quint32> SearchResults;
inline void setupToolbar();
inline void setupIcons();
@ -124,6 +128,10 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
QSystemTrayIcon* SysTray;
QAction* ViewShowToolbarAction;
QMenu* SysTrayMenu;
QAssistantClient* HelpBrowser;
QWidget* NormalCentralWidget;
QWidget* LockedCentralWidget;
Ui_WorkspaceLockedWidget WorkspaceLockedWidget;
bool ShutingDown;
};

View File

@ -52,7 +52,8 @@ FORMS += forms/EditGroupDlg.ui \
forms/CustomizeDetailViewDlg.ui \
forms/CalendarDlg.ui \
forms/TrashCanDlg.ui \
forms/ExpiredEntriesDlg.ui
forms/ExpiredEntriesDlg.ui \
forms/WorkspaceLockedWidget.ui
TRANSLATIONS += translations/keepass-de_DE.ts \
translations/keepass-ru_RU.ts \
translations/keepass-es_ES.ts \
@ -172,7 +173,8 @@ CONFIG += debug \
qt \
thread \
warn_off \
dbus
dbus \
assistant
QT += dbus xml
TEMPLATE = app
INCLUDEPATH += . \

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff