fixed problem in PasswordDlg when option 'LastKey' had value PASSWORD, loading translations for file dialogs, discard option LastKey* when LastFile is empty

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@62 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 19 years ago
parent b99d1d812c
commit 5aa833331d
  1. 4
      src/PwManager.cpp
  2. 11
      src/dialogs/EditEntryDlg.cpp
  3. 2
      src/dialogs/PasswordDlg.cpp
  4. 50
      src/forms/EditEntryDlg.ui
  5. 17
      src/main.cpp
  6. 24
      src/mainwindow.cpp

@ -147,7 +147,7 @@ else if(CryptoAlgorithmus == ALGO_TWOFISH)
total_size - DB_HEADER_SIZE, (Q_UINT8 *)buffer + DB_HEADER_SIZE);
}
if((crypto_size > 2147483446) || (crypto_size == 0)){err=tr("Decryption failed.\nThe key is wrong or the file is damaged."); return false;}
if((crypto_size > 2147483446) || (!crypto_size && NumGroups)){err=tr("Decryption failed.\nThe key is wrong or the file is damaged."); return false;}
sha256_starts(&sha32);
sha256_update(&sha32,(unsigned char *)buffer + DB_HEADER_SIZE,crypto_size);
@ -858,7 +858,7 @@ EncryptedPartSize = (unsigned long)twofish.padEncrypt((Q_UINT8*)buffer+DB_HEADER
pos - DB_HEADER_SIZE,
(Q_UINT8*)buffer+DB_HEADER_SIZE);
}
if((EncryptedPartSize > 2147483446) || (EncryptedPartSize == 0)){
if((EncryptedPartSize > 2147483446) || (!EncryptedPartSize && Groups.size())){
_ERROR
delete [] buffer;
return false;

@ -154,6 +154,7 @@ Combo_Group->setCurrentItem(db->getGroupIndex(entry->GroupID));
void CEditEntryDlg::OnButtonOK()
{
bool EntryMoved=false;
if(QString::compare(Edit_Password->text(),Edit_Password_w->text())!=0){
QMessageBox::warning(NULL,tr("Warning"),tr("Password and password repetition are not equal.\nPlease check your input."),tr("OK"));
return;
@ -176,6 +177,8 @@ entry->Password.unlock();
if(entry->Password.string()!=Edit_Password->text())
ModFlag=true;
entry->Password.lock();
if(entry->ImageID!=Combo_IconPicker->currentItem())
ModFlag=true;
entry->Expire=DateTime_Expire->dateTime();
entry->LastAccess=QDateTime::currentDateTime();
@ -187,10 +190,14 @@ QString s=Edit_Password->text();
entry->Password.setString(s,true);
entry->Additional=Edit_Comment->text();
if(Combo_Group->currentItem()!=db->getGroupIndex(entry->GroupID)){
db->moveEntry(entry,&db->Groups[Combo_Group->currentItem()]);
db->moveEntry(entry,&db->Groups[Combo_Group->currentItem()]);
EntryMoved=true; ModFlag=true;
}
entry->ImageID=Combo_IconPicker->currentItem();
done(1);
if(ModFlag&&EntryMoved)done(2);
else if(ModFlag)done(1);
else done(0);
}
void CEditEntryDlg::OnButtonCancel()

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

@ -8,7 +8,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<width>500</width>
<height>526</height>
</rect>
</property>
@ -22,13 +22,13 @@
</property>
<property name="minimumSize" >
<size>
<width>493</width>
<width>500</width>
<height>526</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>493</width>
<width>500</width>
<height>526</height>
</size>
</property>
@ -70,28 +70,7 @@
<string>Alt+C</string>
</property>
</widget>
<widget class="QLabel" name="Banner" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<height>50</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="" >
<widget class="QWidget" name="layoutWidget" >
<property name="geometry" >
<rect>
<x>10</x>
@ -384,6 +363,27 @@
</item>
</layout>
</widget>
<widget class="QLabel" name="Banner" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>50</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction></pixmapfunction>

@ -29,6 +29,7 @@
#include <QImage>
#include <QStyleFactory>
#include <QProcess>
#include <QLibraryInfo>
#include "main.h"
#include "PwmConfig.h"
@ -93,11 +94,13 @@ else{
//Internationalization
QLocale loc=QLocale::system();
QTranslator* translator = NULL;
QTranslator* qtTranslator=NULL;
translator=new QTranslator;
qtTranslator=new QTranslator;
bool TrFound=true;
if(!translator->load("keepass-"+loc.name(),app->applicationDirPath()+"/../share/keepass/i18n/")){
if(!translator->load("keepass-"+loc.name(),QDir::homeDirPath()+"/.keepass/")){
qWarning(QString("No Translation found for %1 (%2)")
qWarning(QString("KeePassX: No Translation found for language '%1 (%2)'")
.arg(QLocale::languageToString(loc.language()))
.arg(QLocale::countryToString(loc.country())));
TrFound=false;
@ -109,6 +112,18 @@ if(TrFound)
else
delete translator;
if(!qtTranslator->load("qt_"+loc.name().left(2),QLibraryInfo::location(QLibraryInfo::TranslationsPath))){
qWarning(QString("Qt: No Translation found for '%1 (%2)'")
.arg(QLocale::languageToString(loc.language()))
.arg(QLocale::countryToString(loc.country())));
delete qtTranslator;
}else{
app->installTranslator(qtTranslator);
}
TrActive=TrFound;
loadImages();
SecString::generateSessionKey();

@ -57,7 +57,6 @@
KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){
Start=true;
setupUi(this);
@ -250,9 +249,12 @@ void KeepassMainWindow::setupMenus(){
}
void KeepassMainWindow::openDatabase(QString filename,bool s){
void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
Q_ASSERT(!FileOpen);
CPasswordDialog PasswordDlg(this,"Password Dialog",true,s);
if(!IsAuto){
config.LastKeyLocation=QString();
config.LastKeyType=PASSWORD;}
CPasswordDialog PasswordDlg(this,"Password Dialog",true,IsAuto);
PasswordDlg.setCaption(filename);
int r=PasswordDlg.exec();
if(r==0) return;
@ -400,9 +402,18 @@ else{
void KeepassMainWindow::editEntry(CEntry* pEntry){
CEditEntryDlg dlg(db,pEntry,this,"EditEntryDialog",true);
dlg.exec();
EntryView->refreshItems();
if(dlg.ModFlag)setStateFileModified(true);
switch(dlg.exec()){
case 0: //canceled or no changes
break;
case 1: //modifications but same group
EntryView->refreshItems();
setStateFileModified(true);
break;
case 2: //entry moved to another group
EntryView->updateItems(currentGroup()->ID);
setStateFileModified(true);
break;
}
}
void KeepassMainWindow::setStateFileModified(bool mod){
@ -554,6 +565,7 @@ else Q_ASSERT(false);
bool KeepassMainWindow::OnFileSave(){
if(db->file->fileName()==QString())
return OnFileSaveAs();
config.LastFile=db->file->fileName();
if(db->saveDatabase())
setStateFileModified(false);
else{