More fixes for "automatically lock database"

Removed some unneeded includes
Improved code formatting

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@187 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent 6850cae8dd
commit a30643a99d
  1. 2
      src/dialogs/AboutDlg.h
  2. 1
      src/dialogs/CollectEntropyDlg.cpp
  3. 2
      src/dialogs/CollectEntropyDlg.h
  4. 2
      src/dialogs/CustomizeDetailViewDlg.h
  5. 4
      src/dialogs/DatabaseSettingsDlg.h
  6. 2
      src/dialogs/EditEntryDlg.h
  7. 30
      src/dialogs/EditGroupDlg.h
  8. 2
      src/dialogs/ExpiredEntriesDlg.h
  9. 2
      src/dialogs/ManageBookmarksDlg.h
  10. 100
      src/dialogs/PasswordDlg.h
  11. 1
      src/dialogs/PasswordGenDlg.cpp
  12. 4
      src/dialogs/SearchDlg.h
  13. 51
      src/dialogs/SelectIconDlg.h
  14. 2
      src/dialogs/SettingsDlg.h
  15. 27
      src/dialogs/SimplePasswordDlg.h
  16. 3
      src/lib/EntryView.cpp
  17. 2
      src/lib/EntryView.h
  18. 2
      src/lib/GroupView.cpp
  19. 2
      src/lib/GroupView.h
  20. 29
      src/lib/UrlLabel.h
  21. 2
      src/lib/WaitAnimationWidget.h
  22. 17
      src/main.cpp
  23. 7
      src/main.h
  24. 16
      src/mainwindow.cpp
  25. 3
      src/mainwindow.h

@ -22,7 +22,7 @@
#include "ui_AboutDlg.h"
class AboutDialog : public QDialog, public Ui_AboutDlg
class AboutDialog : public QDialog, private Ui_AboutDlg
{
Q_OBJECT

@ -19,7 +19,6 @@
***************************************************************************/
#include "crypto/yarrow.h"
#include "CollectEntropyDlg.h"

@ -23,7 +23,7 @@
#include "ui_CollectEntropyDlg.h"
class CollectEntropyDlg: public QDialog, public Ui_CollectEntropyDlg{
class CollectEntropyDlg: public QDialog, private Ui_CollectEntropyDlg{
Q_OBJECT
public:
CollectEntropyDlg(QWidget* parent);

@ -22,7 +22,7 @@
#include "ui_CustomizeDetailViewDlg.h"
class CustomizeDetailViewDialog : public QDialog, public Ui_CustomizeDetailViewDialog{
class CustomizeDetailViewDialog : public QDialog, private Ui_CustomizeDetailViewDialog{
Q_OBJECT
public:
CustomizeDetailViewDialog(QWidget* parent);

@ -23,7 +23,7 @@
#include "ui_DatabaseSettingsDlg.h"
class CDbSettingsDlg : public QDialog, public Ui_DatabaseSettingsDlg
class CDbSettingsDlg : public QDialog, private Ui_DatabaseSettingsDlg
{
Q_OBJECT
public:
@ -31,7 +31,7 @@ class CDbSettingsDlg : public QDialog, public Ui_DatabaseSettingsDlg
~CDbSettingsDlg();
virtual void paintEvent(QPaintEvent *);
public slots:
private slots:
virtual void OnCancel();
virtual void OnOK();

@ -24,7 +24,7 @@
#include "ui_EditEntryDlg.h"
#include "Kdb3Database.h"
class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
class CEditEntryDlg : public QDialog, private Ui_EditEntryDialog
{
Q_OBJECT
public:

@ -23,23 +23,23 @@
#include "ui_EditGroupDlg.h"
class CEditGroupDialog : public QDialog, public Ui_EditGroupDialog
class CEditGroupDialog : public QDialog, private Ui_EditGroupDialog
{
Q_OBJECT
public:
CEditGroupDialog(IDatabase*,IGroupHandle*,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
CEditGroupDialog(IDatabase*,CGroup*,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CEditGroupDialog();
virtual void showEvent(QShowEvent *event);
private:
IDatabase* db;
IGroupHandle* handle;
CGroup* group;
Q_OBJECT
public:
CEditGroupDialog(IDatabase*,IGroupHandle*,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
CEditGroupDialog(IDatabase*,CGroup*,QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~CEditGroupDialog();
virtual void showEvent(QShowEvent *event);
private:
IDatabase* db;
IGroupHandle* handle;
CGroup* group;
public slots:
virtual void OnOK();
virtual void OnCancel();
virtual void OnIconDlg();
private slots:
virtual void OnOK();
virtual void OnCancel();
virtual void OnIconDlg();
};
#endif

@ -24,7 +24,7 @@
#include "ui_ExpiredEntriesDlg.h"
class ExpiredEntriesDialog:public QDialog, public Ui_ExpiredEntriesDialog{
class ExpiredEntriesDialog:public QDialog, private Ui_ExpiredEntriesDialog{
Q_OBJECT
public:
ExpiredEntriesDialog(QWidget* parent,IDatabase* database,const QList<IEntryHandle*>& Entries);

@ -22,8 +22,6 @@
#include "ui_ManageBookmarksDlg.h"
#include "main.h"
class ManageBookmarksDlg : public QDialog, private Ui::ManageBookmarksDlg
{
Q_OBJECT

@ -20,65 +20,61 @@
#ifndef PASSWORDDIALOG_H
#define PASSWORDDIALOG_H
#include <QPixmap>
#include <QPaintEvent>
#include "ui_PasswordDlg.h"
#include "main.h"
#include "lib/UrlLabel.h"
#include "Database.h"
class PasswordDialog : public QDialog, public Ui_PasswordDlg {
Q_OBJECT
public:
enum DlgMode {
Mode_Ask, // Normal password entry when opening a database
Mode_Set, // Setting password for the first time after creating a new database
Mode_Change // Changing the password of a database
};
enum DlgFlags {
Flag_None = 0x00,
Flag_Auto = 0x01 // Dialog was automatically opened on start-up
};
enum DlgExit {
Exit_Ok=QDialog::Accepted,
Exit_Cancel=QDialog::Rejected,
Exit_Quit=3
};
typedef bool (KeyFileGenProc)(const QString& filename,QString* error);
class PasswordDialog : public QDialog, private Ui_PasswordDlg {
Q_OBJECT
public:
enum DlgMode {
Mode_Ask, // Normal password entry when opening a database
Mode_Set, // Setting password for the first time after creating a new database
Mode_Change // Changing the password of a database
};
PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename=QString());
// result functions
QString selectedBookmark();
QString keyFile();
QString password();
enum DlgFlags {
Flag_None = 0x00,
Flag_Auto = 0x01 // Dialog was automatically opened on start-up
};
enum DlgExit {
Exit_Ok=QDialog::Accepted,
Exit_Cancel=QDialog::Rejected,
Exit_Quit=3
};
typedef bool (KeyFileGenProc)(const QString& filename,QString* error);
PasswordDialog(QWidget* parent,DlgMode mode,DlgFlags flags,const QString& filename=QString());
// result functions
QString selectedBookmark();
QString keyFile();
QString password();
public slots:
void OnOK();
void OnCancel();
void OnButtonBrowse();
void OnButtonQuit();
void OnGenKeyFile();
void OnButtonBack();
void ChangeEchoModeDatabaseKey();
void OnBookmarkTriggered(QAction* action);
void OnCheckBoxesChanged(int state);
private slots:
void OnOK();
void OnCancel();
void OnButtonBrowse();
void OnButtonQuit();
void OnGenKeyFile();
void OnButtonBack();
void ChangeEchoModeDatabaseKey();
void OnBookmarkTriggered(QAction* action);
void OnCheckBoxesChanged(int state);
private:
DlgMode Mode;
QPixmap BannerPixmap;
QString BookmarkFilename;
QString Filename;
QString Password;
QString KeyFile;
void setStatePasswordOnly();
void setStateKeyFileOnly();
void setStateBoth();
virtual void paintEvent(QPaintEvent*);
private:
DlgMode Mode;
QPixmap BannerPixmap;
QString BookmarkFilename;
QString Filename;
QString Password;
QString KeyFile;
void setStatePasswordOnly();
void setStateKeyFileOnly();
void setStateBoth();
virtual void paintEvent(QPaintEvent*);
};
#endif

@ -21,7 +21,6 @@
#include "dialogs/PasswordGenDlg.h"
#include "dialogs/CollectEntropyDlg.h"
#include "crypto/yarrow.h"
bool CGenPwDialog::EntropyCollected=false;

@ -22,7 +22,7 @@
#include "ui_SearchDlg.h"
class SearchDialog : public QDialog, public Ui_Search_Dlg
class SearchDialog : public QDialog, private Ui_Search_Dlg
{
Q_OBJECT
public:
@ -30,7 +30,7 @@ class SearchDialog : public QDialog, public Ui_Search_Dlg
~SearchDialog();
QList<IEntryHandle*> Result;
public slots:
private slots:
virtual void OnClose();
virtual void OnSearch();

@ -23,31 +23,32 @@
#include "ui_SelectIconDlg.h"
class CSelectIconDlg:public QDialog, public Ui_SelectIconDlg{
Q_OBJECT
public:
CSelectIconDlg(IDatabase* db,int ImageID,QWidget* parent = 0, bool modal = false, Qt::WFlags fl = 0);
public slots:
void OnAddIcon();
void OnPickIcon();
void OnCancel();
void OnDelete();
void OnReplace();
void OnSelectionChanged(QListWidgetItem*);
private:
int Id;
IDatabase* db;
void updateView();
QMenu* CtxMenu;
QAction* DeleteAction;
QAction* ReplaceAction;
QPushButton* Button_PickIcon;
protected:
virtual void contextMenuEvent(QContextMenuEvent *event);
virtual void showEvent(QShowEvent* event);
class CSelectIconDlg:public QDialog, private Ui_SelectIconDlg{
Q_OBJECT
public:
CSelectIconDlg(IDatabase* db,int ImageID,QWidget* parent = 0, bool modal = false, Qt::WFlags fl = 0);
private slots:
void OnAddIcon();
void OnPickIcon();
void OnCancel();
void OnDelete();
void OnReplace();
void OnSelectionChanged(QListWidgetItem*);
private:
int Id;
IDatabase* db;
void updateView();
QMenu* CtxMenu;
QAction* DeleteAction;
QAction* ReplaceAction;
QPushButton* Button_PickIcon;
protected:
virtual void contextMenuEvent(QContextMenuEvent *event);
virtual void showEvent(QShowEvent* event);
};

@ -24,7 +24,7 @@
#include "ui_SettingsDlg.h"
#include "lib/AutoType.h"
class CSettingsDlg : public QDialog, public Ui_SettingsDialog
class CSettingsDlg : public QDialog, private Ui_SettingsDialog
{
Q_OBJECT
public:

@ -23,21 +23,20 @@
#include "ui_SimplePasswordDlg.h"
class SimplePasswordDialog : public QDialog, public Ui_SimplePasswordDialog
class SimplePasswordDialog : public QDialog, private Ui_SimplePasswordDialog
{
Q_OBJECT
public:
SimplePasswordDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~SimplePasswordDialog();
public: QString password;
public slots:
virtual void OnCancel();
virtual void OnOK();
virtual void OnHidePasswordToggled(bool state);
virtual void OnTextChanged(const QString&);
Q_OBJECT
public:
SimplePasswordDialog(QWidget* parent = 0, bool modal = FALSE, Qt::WFlags fl = 0 );
~SimplePasswordDialog();
QString password;
private slots:
virtual void OnCancel();
virtual void OnOK();
virtual void OnHidePasswordToggled(bool state);
virtual void OnTextChanged(const QString&);
};
#endif

@ -563,8 +563,9 @@ void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
mimeData->setData("text/plain;charset=UTF-8",DragItems.first()->text(0).toUtf8());
mimeData->setData("application/x-keepassx-entry",QByteArray((char*)&pDragItems,sizeof(void*)));
drag->setMimeData(mimeData);
EventOccurredBlock = true;
drag->exec(Qt::MoveAction);
EventOccurredBlock = false;
}
void KeepassEntryView::removeDragItems(){

@ -69,7 +69,7 @@ class KeepassEntryView:public QTreeWidget{
virtual void resizeEvent(QResizeEvent* event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseMoveEvent(QMouseEvent *event);
public slots:
private slots:
void OnColumnResized(int index,int OldSize, int NewSize);
void OnHeaderSectionClicked(int index);
void OnGroupChanged(IGroupHandle* group);

@ -467,7 +467,9 @@ void KeepassGroupView::mouseMoveEvent(QMouseEvent *event){
mimeData->setData("application/x-keepassx-group",QByteArray());
drag->setMimeData(mimeData);
EventOccurredBlock = true;
drag->exec(Qt::MoveAction);
EventOccurredBlock = false;
}
void KeepassGroupView::OnItemExpanded(QTreeWidgetItem* item){

@ -58,7 +58,7 @@ class KeepassGroupView:public QTreeWidget{
GroupViewDragType DragType;
QList<QTreeWidgetItem*>* EntryDragItems;
public slots:
private slots:
void OnCurrentGroupChanged(QTreeWidgetItem*);
void OnDeleteGroup();
void OnNewGroup();

@ -22,24 +22,25 @@
#define _LINKLABEL_H_
class LinkLabel : public QLabel{
Q_OBJECT
public:
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0);
~LinkLabel();
void setPos(int x,int y);
QString url();
Q_OBJECT
public:
LinkLabel(QWidget *parent,const QString& text=QString::null, int x=0, int y=0,Qt::WFlags f=0);
~LinkLabel();
void setPos(int x,int y);
QString url();
public slots:
virtual void setText(const QString&);
public slots:
virtual void setText(const QString&);
signals:
void clicked();
signals:
void clicked();
protected:
virtual void mouseReleaseEvent(QMouseEvent* event);
protected:
virtual void mouseReleaseEvent(QMouseEvent* event);
private:
QString URL;
private:
QString URL;
};

@ -28,7 +28,7 @@ class WaitAnimationWidget:public QWidget{
void setRefreshRate(int fps);
void start();
void stop();
public slots:
private slots:
void refreshAnimation();
private:
virtual void paintEvent(QPaintEvent* event);

@ -22,7 +22,6 @@
#include "plugins/interfaces/IFileDialog.h"
#include "plugins/interfaces/IKdeInit.h"
#include "plugins/interfaces/IGnomeInit.h"
#include "plugins/interfaces/IIconTheme.h"
#include <QTranslator>
@ -30,7 +29,6 @@
#include <QPluginLoader>
#include "mainwindow.h"
#include "main.h"
#include "crypto/yarrow.h"
#if defined(Q_WS_X11) && defined(GLOBAL_AUTOTYPE)
#include "Application_X11.h"
#endif
@ -46,6 +44,7 @@ bool TrActive;
QString DetailViewTemplate;
bool EventOccurred;
bool EventOccurredBlock = false;
EventListener* eventListener;
QPixmap* EntryIcons;
IIconTheme* IconLoader=NULL;
@ -181,10 +180,14 @@ int main(int argc, char **argv)
initYarrow(); //init random number generator
SecString::generateSessionKey();
eventListener = new EventListener();
app->installEventFilter(eventListener);
QApplication::setQuitOnLastWindowClosed(false);
KeepassMainWindow *mainWin = new KeepassMainWindow(args.file(), args.startMinimized(), args.startLocked());
int r=app->exec();
delete mainWin;
delete eventListener;
fileDlgHistory.save();
delete app;
@ -312,4 +315,12 @@ QString findPlugin(const QString& filename){
}
bool EventListener::eventFilter(QObject*, QEvent* event){
if (!EventOccurred){
int t = event->type();
if ( t>=QEvent::MouseButtonPress&&t<=QEvent::KeyRelease || t>=QEvent::HoverEnter&&t<=QEvent::HoverMove )
EventOccurred = true;
}
return false;
}

@ -48,4 +48,11 @@ private:
bool Help;
};
class EventListener : public QObject {
Q_OBJECT
protected:
bool eventFilter(QObject*, QEvent* event);
};
#endif

@ -21,7 +21,6 @@
#include <QStatusBar>
#include "mainwindow.h"
#include "lib/AutoType.h"
#include "lib/FileDialogs.h"
#include "import/Import_PwManager.h"
#include "import/Import_KWalletXml.h"
#include "import/Import_KeePassX_Xml.h"
@ -1009,15 +1008,6 @@ void KeepassMainWindow::showEvent(QShowEvent* event){
QMainWindow::showEvent(event);
}
bool KeepassMainWindow::event(QEvent* event){
if (!EventOccurred){
int t = event->type();
if ( t>=QEvent::MouseButtonPress&&t<=QEvent::KeyRelease || t>=QEvent::HoverEnter&&t<=QEvent::HoverMove )
EventOccurred = true;
}
return QMainWindow::event(event);
}
void KeepassMainWindow::OnExtrasSettings(){
CSettingsDlg dlg(this);
dlg.exec();
@ -1256,8 +1246,12 @@ void KeepassMainWindow::OnInactivityTimer(){
}
else{
inactivityCounter++;
if (inactivityCounter*(inactivityTimer->interval()) >= config->lockAfterSec()*1000)
if (inactivityCounter*(inactivityTimer->interval()) >= config->lockAfterSec()*1000){
QWidget* popUpWidget = QApplication::activePopupWidget();
if (popUpWidget!=NULL)
popUpWidget->hide();
OnUnLockWorkspace();
}
}
}

@ -29,7 +29,7 @@
#include "ui_MainWindow.h"
#include "ui_WorkspaceLockedWidget.h"
class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
class KeepassMainWindow : public QMainWindow, private Ui_MainWindow{
Q_OBJECT
public:
KeepassMainWindow (const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent=0, Qt::WFlags flags=0);
@ -84,7 +84,6 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
void closeEvent(QCloseEvent* event);
void hideEvent(QHideEvent* event);
void showEvent(QShowEvent* event);
bool event(QEvent* event);
void setLock();
void resetLock();
SelectionState GroupSelection, EntrySelection;