fixed seg. fault when moving an entry to another group

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@63 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 19 years ago
parent 5aa833331d
commit 2bf3e5820c
  1. 2
      src/dialogs/PasswordDlg.cpp
  2. 4
      src/main.cpp
  3. 16
      src/mainwindow.cpp
  4. 6
      src/mainwindow.h

@ -47,7 +47,7 @@ if(media.exists()){
} }
Combo_Dirs->setEditText(QString()); Combo_Dirs->setEditText(QString());
if(config.RememberLastKey){ if(config.RememberLastKey && !ChangeKeyMode){
switch(config.LastKeyType){ switch(config.LastKeyType){
//case PASSWORD: setStatePasswordOnly(); break; //Password-Only is already the default //case PASSWORD: setStatePasswordOnly(); break; //Password-Only is already the default
case KEYFILE: setStateKeyFileOnly(); case KEYFILE: setStateKeyFileOnly();

@ -76,7 +76,7 @@ QString ArgFile,ArgCfg,IniFilename;
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg); parseCmdLineArgs(argc,argv,ArgFile,ArgCfg);
AppDir=app->applicationDirPath(); AppDir=app->applicationDirPath();
//Load Config //Load Config
if(ArgCfg==""){ if(ArgCfg==QString()){
if(!QDir(QDir::homeDirPath()+"/.keepass").exists()){ if(!QDir(QDir::homeDirPath()+"/.keepass").exists()){
QDir conf(QDir::homeDirPath()); QDir conf(QDir::homeDirPath());
if(!conf.mkdir(".keepass")){ if(!conf.mkdir(".keepass")){
@ -128,7 +128,7 @@ TrActive=TrFound;
loadImages(); loadImages();
SecString::generateSessionKey(); SecString::generateSessionKey();
int r=0; int r=0;
KeepassMainWindow *mainWin = new KeepassMainWindow(); KeepassMainWindow *mainWin = new KeepassMainWindow(ArgFile);
if(mainWin->Start){ if(mainWin->Start){
mainWin->show(); mainWin->show();
r=app->exec(); r=app->exec();

@ -57,7 +57,7 @@
KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){
Start=true; Start=true;
setupUi(this); setupUi(this);
setGeometry(geometry().x(),geometry().y(),config.MainWinWidth,config.MainWinHeight); setGeometry(geometry().x(),geometry().y(),config.MainWinWidth,config.MainWinHeight);
@ -76,7 +76,9 @@ KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWin
setupConnections(); setupConnections();
FileOpen=false; FileOpen=false;
Clipboard=QApplication::clipboard(); Clipboard=QApplication::clipboard();
if(config.OpenLast && (config.LastFile!=QString()) ){ if(ArgFile!=QString())
openDatabase(ArgFile,false);
else if(config.OpenLast && (config.LastFile!=QString()) ){
QFileInfo file(config.LastFile); QFileInfo file(config.LastFile);
if(file.exists()) if(file.exists())
openDatabase(config.LastFile,true); openDatabase(config.LastFile,true);
@ -130,15 +132,17 @@ void KeepassMainWindow::setupConnections(){
connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings())); connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings()));
connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook()));
connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout())); connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout()));
connect(GroupView,SIGNAL(entryDropped()),EntryView,SLOT(updateItems())); connect(GroupView,SIGNAL(entryDropped()),EntryView,SLOT(updateItems()));
connect(this,SIGNAL(entryChanged()),EntryView,SLOT(updateItems()),Qt::QueuedConnection);
connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut())); connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut()));
connect(GroupView,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this, connect(GroupView,SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),this,
SLOT(OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*))); SLOT(OnCurrentGroupChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
connect(GroupView,SIGNAL(itemExpanded(QTreeWidgetItem*)),this,SLOT(OnItemExpanded(QTreeWidgetItem*))); connect(GroupView,SIGNAL(itemExpanded(QTreeWidgetItem*)),this,SLOT(OnItemExpanded(QTreeWidgetItem*)));
connect(GroupView,SIGNAL(itemCollapsed(QTreeWidgetItem*)),this,SLOT(OnItemCollaped(QTreeWidgetItem*))); connect(GroupView,SIGNAL(itemCollapsed(QTreeWidgetItem*)),this,SLOT(OnItemCollaped(QTreeWidgetItem*)));
connect(EntryView,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),this, connect(EntryView,SIGNAL(itemActivated(QTreeWidgetItem*,int)),this,
SLOT(OnEntryItemDoubleClicked(QTreeWidgetItem*,int))); SLOT(OnEntryItemDoubleClicked(QTreeWidgetItem*,int)));
connect(EntryView,SIGNAL(itemSelectionChanged()), this, SLOT(OnEntrySelectionChanged())); connect(EntryView,SIGNAL(itemSelectionChanged()), this, SLOT(OnEntrySelectionChanged()));
connect(GroupView,SIGNAL(itemSelectionChanged()), this, SLOT(OnGroupSelectionChanged())); connect(GroupView,SIGNAL(itemSelectionChanged()), this, SLOT(OnGroupSelectionChanged()));
@ -410,7 +414,7 @@ switch(dlg.exec()){
setStateFileModified(true); setStateFileModified(true);
break; break;
case 2: //entry moved to another group case 2: //entry moved to another group
EntryView->updateItems(currentGroup()->ID); emit entryChanged(); //a direct call of updateItems() would cause a SegFault because of the TreeView base class slots
setStateFileModified(true); setStateFileModified(true);
break; break;
} }
@ -977,6 +981,10 @@ CAboutDialog dlg(this,"AboutDlg");
dlg.exec(); dlg.exec();
} }
void KeepassMainWindow::OnHelpHandbook(){
openBrowser(AppDir+"/../share/doc/keepass/index.html");
}
void KeepassMainWindow::OnViewShowToolbar(bool show){ void KeepassMainWindow::OnViewShowToolbar(bool show){
config.Toolbar=show; config.Toolbar=show;
toolBar->setVisible(config.Toolbar); toolBar->setVisible(config.Toolbar);

@ -48,10 +48,13 @@
class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
Q_OBJECT Q_OBJECT
public: public:
KeepassMainWindow (QWidget *parent=0, Qt::WFlags flags=0); KeepassMainWindow (const QString& ArgFile,QWidget *parent=0, Qt::WFlags flags=0);
PwDatabase* db; PwDatabase* db;
bool Start; bool Start;
signals:
void entryChanged();
private slots: private slots:
void OnFileNew(); void OnFileNew();
void OnFileOpen(); void OnFileOpen();
@ -90,6 +93,7 @@ private slots:
void OnFileModified(); void OnFileModified();
void OnExtrasSettings(); void OnExtrasSettings();
void OnHelpAbout(); void OnHelpAbout();
void OnHelpHandbook();
void OnItemExpanded(QTreeWidgetItem*); void OnItemExpanded(QTreeWidgetItem*);
void OnItemCollaped(QTreeWidgetItem*); void OnItemCollaped(QTreeWidgetItem*);
void OnHideSearchGroup(); void OnHideSearchGroup();