Fixed: database could be automatically locked while a file dialog is opened

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@184 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent a85dbe65fa
commit d359363e7f
  1. 1
      src/keepassx.h
  2. 6
      src/lib/FileDialogs.cpp
  3. 1
      src/main.cpp
  4. 5
      src/mainwindow.cpp

@ -102,6 +102,7 @@ extern bool TrActive;
extern QString DetailViewTemplate;
extern QPixmap *EntryIcons;
extern bool EventOccurred;
extern bool EventOccurredBlock;
#endif //__cplusplus
#endif //KEEPASS_X_

@ -29,6 +29,7 @@ void KpxFileDialogs::setPlugin(IFileDialog* plugin){
QString KpxFileDialogs::openExistingFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,QString Dir,int SelectedFilter)
{
EventOccurredBlock = true;
if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
if(Dir==QString())
Dir=fileDlgHistory.getDir(Name);
@ -38,11 +39,13 @@ QString KpxFileDialogs::openExistingFile(QWidget* Parent, const QString& Name, c
if(!result.isEmpty()){
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
}
EventOccurredBlock = false;
return result;
}
QStringList KpxFileDialogs::openExistingFiles(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,QString Dir,int SelectedFilter)
{
EventOccurredBlock = true;
if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
if(Dir==QString())
Dir=fileDlgHistory.getDir(Name);
@ -52,11 +55,13 @@ QStringList KpxFileDialogs::openExistingFiles(QWidget* Parent, const QString& Na
if(!results.isEmpty()){
fileDlgHistory.set(Name,results[0].left(results[0].lastIndexOf("/")+1),iFileDialog->getLastFilter());
}
EventOccurredBlock = false;
return results;
}
QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,bool OverWriteWarn,QString Dir,int SelectedFilter)
{
EventOccurredBlock = true;
if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
if(Dir==QString())
Dir=fileDlgHistory.getDir(Name);
@ -66,6 +71,7 @@ QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QSt
if(!result.isEmpty()){
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
}
EventOccurredBlock = false;
return result;
}

@ -45,6 +45,7 @@ QString PluginLoadError;
bool TrActive;
QString DetailViewTemplate;
bool EventOccurred;
bool EventOccurredBlock = false;
QPixmap* EntryIcons;
IIconTheme* IconLoader=NULL;

@ -1245,13 +1245,10 @@ void KeepassMainWindow::OnInactivityTimer(){
if (IsLocked || !FileOpen)
return;
QWidgetList widgets = QApplication::topLevelWidgets();
for (int i=0; i<widgets.size(); i++){
if (widgets[i]->windowModality()==Qt::ApplicationModal){
if (QApplication::activeModalWidget()!=NULL || EventOccurredBlock){
inactivityCounter = 0;
return;
}
}
if (EventOccurred){
inactivityCounter = 0;