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
This commit is contained in:
parent
b99d1d812c
commit
5aa833331d
|
@ -147,7 +147,7 @@ else if(CryptoAlgorithmus == ALGO_TWOFISH)
|
||||||
total_size - DB_HEADER_SIZE, (Q_UINT8 *)buffer + DB_HEADER_SIZE);
|
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_starts(&sha32);
|
||||||
sha256_update(&sha32,(unsigned char *)buffer + DB_HEADER_SIZE,crypto_size);
|
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,
|
pos - DB_HEADER_SIZE,
|
||||||
(Q_UINT8*)buffer+DB_HEADER_SIZE);
|
(Q_UINT8*)buffer+DB_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
if((EncryptedPartSize > 2147483446) || (EncryptedPartSize == 0)){
|
if((EncryptedPartSize > 2147483446) || (!EncryptedPartSize && Groups.size())){
|
||||||
_ERROR
|
_ERROR
|
||||||
delete [] buffer;
|
delete [] buffer;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -154,6 +154,7 @@ Combo_Group->setCurrentItem(db->getGroupIndex(entry->GroupID));
|
||||||
|
|
||||||
void CEditEntryDlg::OnButtonOK()
|
void CEditEntryDlg::OnButtonOK()
|
||||||
{
|
{
|
||||||
|
bool EntryMoved=false;
|
||||||
if(QString::compare(Edit_Password->text(),Edit_Password_w->text())!=0){
|
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"));
|
QMessageBox::warning(NULL,tr("Warning"),tr("Password and password repetition are not equal.\nPlease check your input."),tr("OK"));
|
||||||
return;
|
return;
|
||||||
|
@ -176,6 +177,8 @@ entry->Password.unlock();
|
||||||
if(entry->Password.string()!=Edit_Password->text())
|
if(entry->Password.string()!=Edit_Password->text())
|
||||||
ModFlag=true;
|
ModFlag=true;
|
||||||
entry->Password.lock();
|
entry->Password.lock();
|
||||||
|
if(entry->ImageID!=Combo_IconPicker->currentItem())
|
||||||
|
ModFlag=true;
|
||||||
|
|
||||||
entry->Expire=DateTime_Expire->dateTime();
|
entry->Expire=DateTime_Expire->dateTime();
|
||||||
entry->LastAccess=QDateTime::currentDateTime();
|
entry->LastAccess=QDateTime::currentDateTime();
|
||||||
|
@ -187,10 +190,14 @@ QString s=Edit_Password->text();
|
||||||
entry->Password.setString(s,true);
|
entry->Password.setString(s,true);
|
||||||
entry->Additional=Edit_Comment->text();
|
entry->Additional=Edit_Comment->text();
|
||||||
if(Combo_Group->currentItem()!=db->getGroupIndex(entry->GroupID)){
|
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();
|
entry->ImageID=Combo_IconPicker->currentItem();
|
||||||
done(1);
|
|
||||||
|
if(ModFlag&&EntryMoved)done(2);
|
||||||
|
else if(ModFlag)done(1);
|
||||||
|
else done(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEditEntryDlg::OnButtonCancel()
|
void CEditEntryDlg::OnButtonCancel()
|
||||||
|
|
|
@ -49,7 +49,7 @@ if(media.exists()){
|
||||||
Combo_Dirs->setEditText(QString());
|
Combo_Dirs->setEditText(QString());
|
||||||
if(config.RememberLastKey){
|
if(config.RememberLastKey){
|
||||||
switch(config.LastKeyType){
|
switch(config.LastKeyType){
|
||||||
case PASSWORD: setStatePasswordOnly(); break;
|
//case PASSWORD: setStatePasswordOnly(); break; //Password-Only is already the default
|
||||||
case KEYFILE: setStateKeyFileOnly();
|
case KEYFILE: setStateKeyFileOnly();
|
||||||
Combo_Dirs->setEditText(config.LastKeyLocation);
|
Combo_Dirs->setEditText(config.LastKeyLocation);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>493</width>
|
<width>500</width>
|
||||||
<height>526</height>
|
<height>526</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -22,13 +22,13 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>493</width>
|
<width>500</width>
|
||||||
<height>526</height>
|
<height>526</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>493</width>
|
<width>500</width>
|
||||||
<height>526</height>
|
<height>526</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
|
@ -70,28 +70,7 @@
|
||||||
<string>Alt+C</string>
|
<string>Alt+C</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="Banner" >
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
<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="" >
|
|
||||||
<property name="geometry" >
|
<property name="geometry" >
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
|
@ -384,6 +363,27 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
<pixmapfunction></pixmapfunction>
|
<pixmapfunction></pixmapfunction>
|
||||||
|
|
17
src/main.cpp
17
src/main.cpp
|
@ -29,6 +29,7 @@
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
#include <QLibraryInfo>
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "PwmConfig.h"
|
#include "PwmConfig.h"
|
||||||
|
@ -93,11 +94,13 @@ else{
|
||||||
//Internationalization
|
//Internationalization
|
||||||
QLocale loc=QLocale::system();
|
QLocale loc=QLocale::system();
|
||||||
QTranslator* translator = NULL;
|
QTranslator* translator = NULL;
|
||||||
|
QTranslator* qtTranslator=NULL;
|
||||||
translator=new QTranslator;
|
translator=new QTranslator;
|
||||||
|
qtTranslator=new QTranslator;
|
||||||
bool TrFound=true;
|
bool TrFound=true;
|
||||||
if(!translator->load("keepass-"+loc.name(),app->applicationDirPath()+"/../share/keepass/i18n/")){
|
if(!translator->load("keepass-"+loc.name(),app->applicationDirPath()+"/../share/keepass/i18n/")){
|
||||||
if(!translator->load("keepass-"+loc.name(),QDir::homeDirPath()+"/.keepass/")){
|
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::languageToString(loc.language()))
|
||||||
.arg(QLocale::countryToString(loc.country())));
|
.arg(QLocale::countryToString(loc.country())));
|
||||||
TrFound=false;
|
TrFound=false;
|
||||||
|
@ -109,6 +112,18 @@ if(TrFound)
|
||||||
else
|
else
|
||||||
delete translator;
|
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;
|
TrActive=TrFound;
|
||||||
loadImages();
|
loadImages();
|
||||||
SecString::generateSessionKey();
|
SecString::generateSessionKey();
|
||||||
|
|
|
@ -57,7 +57,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){
|
KeepassMainWindow::KeepassMainWindow(QWidget *parent, Qt::WFlags flags):QMainWindow(parent,flags){
|
||||||
Start=true;
|
Start=true;
|
||||||
setupUi(this);
|
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);
|
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);
|
PasswordDlg.setCaption(filename);
|
||||||
int r=PasswordDlg.exec();
|
int r=PasswordDlg.exec();
|
||||||
if(r==0) return;
|
if(r==0) return;
|
||||||
|
@ -400,9 +402,18 @@ else{
|
||||||
|
|
||||||
void KeepassMainWindow::editEntry(CEntry* pEntry){
|
void KeepassMainWindow::editEntry(CEntry* pEntry){
|
||||||
CEditEntryDlg dlg(db,pEntry,this,"EditEntryDialog",true);
|
CEditEntryDlg dlg(db,pEntry,this,"EditEntryDialog",true);
|
||||||
dlg.exec();
|
switch(dlg.exec()){
|
||||||
EntryView->refreshItems();
|
case 0: //canceled or no changes
|
||||||
if(dlg.ModFlag)setStateFileModified(true);
|
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){
|
void KeepassMainWindow::setStateFileModified(bool mod){
|
||||||
|
@ -554,6 +565,7 @@ else Q_ASSERT(false);
|
||||||
bool KeepassMainWindow::OnFileSave(){
|
bool KeepassMainWindow::OnFileSave(){
|
||||||
if(db->file->fileName()==QString())
|
if(db->file->fileName()==QString())
|
||||||
return OnFileSaveAs();
|
return OnFileSaveAs();
|
||||||
|
config.LastFile=db->file->fileName();
|
||||||
if(db->saveDatabase())
|
if(db->saveDatabase())
|
||||||
setStateFileModified(false);
|
setStateFileModified(false);
|
||||||
else{
|
else{
|
||||||
|
|
Loading…
Reference in New Issue