diff --git a/src/PwManager.cpp b/src/PwManager.cpp
index 2b6bcff..018f0ae 100755
--- a/src/PwManager.cpp
+++ b/src/PwManager.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;
diff --git a/src/dialogs/EditEntryDlg.cpp b/src/dialogs/EditEntryDlg.cpp
index 25a0b96..da37b26 100755
--- a/src/dialogs/EditEntryDlg.cpp
+++ b/src/dialogs/EditEntryDlg.cpp
@@ -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()
diff --git a/src/dialogs/PasswordDlg.cpp b/src/dialogs/PasswordDlg.cpp
index d92a5ca..9127ab8 100755
--- a/src/dialogs/PasswordDlg.cpp
+++ b/src/dialogs/PasswordDlg.cpp
@@ -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;
diff --git a/src/forms/EditEntryDlg.ui b/src/forms/EditEntryDlg.ui
index fcf0366..dc30f5c 100644
--- a/src/forms/EditEntryDlg.ui
+++ b/src/forms/EditEntryDlg.ui
@@ -8,7 +8,7 @@
0
0
- 493
+ 500
526
@@ -22,13 +22,13 @@
- 493
+ 500
526
- 493
+ 500
526
@@ -70,28 +70,7 @@
Alt+C
-
-
-
- 0
- 0
- 493
- 50
-
-
-
-
- 7
- 5
- 0
- 0
-
-
-
- true
-
-
-
+
10
@@ -384,6 +363,27 @@
+
+
+
+ 0
+ 0
+ 500
+ 50
+
+
+
+
+ 7
+ 5
+ 0
+ 0
+
+
+
+ true
+
+
diff --git a/src/main.cpp b/src/main.cpp
index c68b772..1c65073 100755
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#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();
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 26b648a..5cc97b2 100755
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -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{