QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
return;}
return;
}
if(KeyType==BOTH){
if(password==""){
@ -171,20 +175,6 @@ void CPasswordDialog::OnOK(){
if(KeyType==BOTH||KeyType==KEYFILE){
QFileInfofileinfo(keyfile);
if(Mode_Set){
if(fileinfo.exists()){
switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file\nor do you want to overwrite it with a new generated one?"),
tr("Use"),tr("Overwrite"),tr("Cancel"),0,2)){
case0:OverwriteKeyFile=false;
break;
case1:OverwriteKeyFile=true;
break;
case2:return;
}
}
}
else{
if(!fileinfo.exists()){
QMessageBox::warning(this,tr("Error"),tr("The selected key file or directory does not exist."),tr("OK"),"","",0,0);
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
return;}
keyfile+=files[0];
}else{
}
else{/* pwsafe.key exists */
if(!QFileInfo(file).isReadable()){
QMessageBox::warning(this,tr("Error"),tr("The key file found in the given directory is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
return;}
keyfile+="pwsafe.key";
}
}else{
}
else{/* not a directory */
QFilefile(keyfile);
if(!file.exists()){
QMessageBox::warning(this,tr("Error"),tr("Key file could not be found."),tr("OK"),"","",0,0);
QMessageBox::warning(this,tr("Error"),tr("Key file is not readable.\nPlease check your permissions."),tr("OK"),"","",0,0);
return;}
}
}
}
if(config.RememberLastKey){
config.LastKeyLocation=keyfile;
config.LastKeyType=KeyType;
}
done(1);
}
if(doAuth())done(1);
}
voidCPasswordDialog::OnOK_Set(){
password=Edit_Password->text();
if(password!=Edit_PasswordRep->text()){
password=Edit_Password->text();
if(password!=Edit_PasswordRep->text()){
QMessageBox::warning(this,tr("Warning"),tr("Password an password repetition are not equal.\nPlease check your input."),tr("OK"),"","",0,0);
return;}
keyfile=Combo_Dirs->currentText();
if(password==""&&keyfile==""){
return;
}
keyfile=Combo_Dirs->currentText();
if(password==""&&keyfile==""){
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
return;}
return;
}
QFilefile(keyfile);
if(QFileInfo(file).isDir()){
if(keyfile!=QString()){
QFilefile(keyfile);
if(QFileInfo(file).isDir()){
if(keyfile.right(1)!="/")keyfile+="/";
QFilefile(keyfile+"pwsafe.key");
if(file.exists()){
intr=QMessageBox::warning(this,tr("Warning"),tr("A file with the name 'pwsafe.key' already exisits in the given directory.\nDo you want to replace it?"),tr("Yes"),tr("No"),"",1,1);
if(r)return;
if(!QFileInfo(file).isWritable()){
QMessageBox::warning(this,tr("Error"),tr("The exisiting file is not writable."),tr("OK"),"","",0,0);
return;}
}
keyfile+="pwsafe.key";
}else{
QFilefile(keyfile);
}
if(file.exists()){
intr=QMessageBox::warning(this,tr("Warning"),tr("A file with the this name already exisits.\nDo you want to replace it?"),tr("Yes"),tr("No"),"",1,1);
if(r)return;
if(!QFileInfo(file).isWritable()){
QMessageBox::warning(this,tr("Error"),tr("The exisiting file is not writable."),tr("OK"),"","",0,0);
return;}
switch(QMessageBox::question(this,tr("File exists."),tr("A file with the selected name already exists, should this file be used as key file or do you want to overwrite it with a newly generated one?"),