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:
+5
-1
@@ -89,7 +89,9 @@ 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));}
|
||||
void setBannerColor2(const QColor& value){settings.setValue("Options/BannerColor2",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");};
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -17,13 +17,15 @@
|
||||
* Free Software Foundation, Inc., *
|
||||
* 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,13 +66,21 @@ 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;
|
||||
QString comment=entry->comment();
|
||||
int c=comment.count("Auto-Type:");
|
||||
@@ -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();
|
||||
|
||||
+6
-10
@@ -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();
|
||||
}
|
||||
@@ -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 load();
|
||||
void clear();
|
||||
private:
|
||||
class Entry{
|
||||
public:
|
||||
|
||||
+31
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
+4
-2
@@ -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 += . \
|
||||
|
||||
+1432
-392
File diff suppressed because it is too large
Load Diff
+1417
-453
File diff suppressed because it is too large
Load Diff
+1421
-528
File diff suppressed because it is too large
Load Diff
+1434
-392
File diff suppressed because it is too large
Load Diff
+1411
-447
File diff suppressed because it is too large
Load Diff
+1314
-575
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user