new config system
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@133 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
9b25cc235d
commit
9dc8f878b5
|
@ -298,9 +298,7 @@ public:
|
|||
|
||||
|
||||
/*! \return the last error message or an empty QString() object if no error occured.*/
|
||||
virtual QString getError()=0;
|
||||
|
||||
|
||||
virtual QString getError()=0;
|
||||
|
||||
/*! Creates a clone of a given entry.
|
||||
All attributes besides the UUID are copied, even the creation date.
|
||||
|
@ -398,7 +396,15 @@ public:
|
|||
\param Fields A pointer to a six element bool array. It defines which fields are included into the search. The order is: title, username, url, password, comment, attachment description. The pointer can also be NULL, than the default pattern is used instead.
|
||||
\return the search results as a list of pointers to the entry handles.*/
|
||||
virtual QList<IEntryHandle*> search(IGroupHandle* Group,const QString& SearchString, bool CaseSensitve, bool RegExp,bool Recursive,bool* Fields)=0;
|
||||
|
||||
|
||||
//! Moves an entry to the recycle bin.
|
||||
virtual void moveToTrash(IEntryHandle* entry)=0;
|
||||
|
||||
//! \returns all entries of the recycle bin.
|
||||
virtual QList<IEntryHandle*> trashEntries()=0;
|
||||
|
||||
//! Empty the recycle bin.
|
||||
virtual void emptyTrash()=0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -34,20 +34,21 @@
|
|||
#include "crypto/yarrow.h"
|
||||
#include "lib/random.h"
|
||||
using namespace std;
|
||||
#include "StandardDatabase.h"
|
||||
#include "Kdb3Database.h"
|
||||
#include "main.h"
|
||||
#include "KpxConfig.h"
|
||||
|
||||
#define UNEXP_ERROR error=QString("Unexpected error in: %1, Line:%2").arg(__FILE__).arg(__LINE__);
|
||||
|
||||
const QDateTime Date_Never(QDate(2999,12,28),QTime(23,59,59));
|
||||
|
||||
|
||||
|
||||
|
||||
bool EntryHandleLessThan(const IEntryHandle* This,const IEntryHandle* Other){
|
||||
if(!This->isValid() && Other->isValid())return true;
|
||||
if(This->isValid() && !Other->isValid())return false;
|
||||
if(!This->isValid() && !Other->isValid())return false;
|
||||
return This->visualIndex()<Other->visualIndex();
|
||||
|
||||
return This->visualIndex()<Other->visualIndex();
|
||||
|
||||
}
|
||||
|
||||
bool StdEntryLessThan(const Kdb3Database::StdEntry& This,const Kdb3Database::StdEntry& Other){
|
||||
|
@ -103,23 +104,23 @@ int Kdb3Database::numIcons(){
|
|||
}
|
||||
|
||||
bool Kdb3Database::parseMetaStream(const StdEntry& entry){
|
||||
|
||||
|
||||
qDebug("%s",entry.Comment.toUtf8().data());
|
||||
|
||||
|
||||
if(entry.Comment=="KPX_GROUP_TREE_STATE"){
|
||||
parseGroupTreeStateMetaStream(entry.Binary);
|
||||
return true;}
|
||||
|
||||
|
||||
if(entry.Comment=="KPX_CUSTOM_ICONS_3"){
|
||||
parseCustomIconsMetaStream(entry.Binary);
|
||||
return true;}
|
||||
return true;}
|
||||
|
||||
if(entry.Comment=="KPX_CUSTOM_ICONS_2")
|
||||
return parseCustomIconsMetaStreamV2(entry.Binary);
|
||||
|
||||
|
||||
if(entry.Comment=="KPX_CUSTOM_ICONS")
|
||||
return parseCustomIconsMetaStreamV1(entry.Binary);
|
||||
|
||||
return parseCustomIconsMetaStreamV1(entry.Binary);
|
||||
|
||||
return false; //unknown MetaStream
|
||||
}
|
||||
|
||||
|
@ -234,7 +235,7 @@ void Kdb3Database::createGroupTreeStateMetaStream(StdEntry* e){
|
|||
if(Groups[i].IsExpanded)
|
||||
bin.data()[8+5*i]=1;
|
||||
else
|
||||
bin.data()[8+5*i]=0;
|
||||
bin.data()[8+5*i]=0;
|
||||
}
|
||||
e->Binary=bin;
|
||||
}
|
||||
|
@ -380,10 +381,10 @@ bool Kdb3Database::createGroupTree(QList<quint32>& Levels){
|
|||
Groups[i].Index=Groups[j].Childs.size();
|
||||
Groups[i].Parent->Childs.append(&Groups[i]);
|
||||
}
|
||||
|
||||
|
||||
QList<int> EntryIndexCounter;
|
||||
for(int i=0;i<Groups.size();i++)EntryIndexCounter << 0;
|
||||
|
||||
|
||||
for(int e=0;e<Entries.size();e++){
|
||||
for(int g=0;g<Groups.size();g++){
|
||||
if(Entries[e].GroupId==Groups[g].Id){
|
||||
|
@ -392,9 +393,9 @@ bool Kdb3Database::createGroupTree(QList<quint32>& Levels){
|
|||
Entries[e].Index=EntryIndexCounter[g];
|
||||
EntryIndexCounter[g]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -408,21 +409,22 @@ void Kdb3Database::createHandles(){
|
|||
EntryHandles.append(EntryHandle(this));
|
||||
Entries[i].Handle=&EntryHandles.back();
|
||||
EntryHandles.back().Entry=&Entries[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Kdb3Database::restoreGroupTreeState(){
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="ExpandAll"){
|
||||
for(int i=0;i<Groups.size();i++){
|
||||
Groups[i].IsExpanded=true;
|
||||
}
|
||||
}
|
||||
else
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="Restore"){
|
||||
switch (config->groupTreeState()){
|
||||
case KpxConfig::RestoreLast:
|
||||
for(int i=0;i<Groups.size();i++){
|
||||
if(TreeStateMetaStream.contains(Groups[i].Id))
|
||||
Groups[i].IsExpanded=TreeStateMetaStream.value(Groups[i].Id);
|
||||
Groups[i].IsExpanded=TreeStateMetaStream.value(Groups[i].Id);
|
||||
}
|
||||
break;
|
||||
|
||||
case KpxConfig::ExpandAll:
|
||||
for(int i=0;i<Groups.size();i++)
|
||||
Groups[i].IsExpanded=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -484,7 +486,7 @@ sha.update(FinalRandomSeed,16);
|
|||
sha.update(MasterKey,32);
|
||||
sha.finish(FinalKey);
|
||||
|
||||
if(Algorithm == Rijndael_Cipher)
|
||||
if(Algorithm == Rijndael_Cipher)
|
||||
{ AESdecrypt aes;
|
||||
aes.key256(FinalKey);
|
||||
aes.cbc_decrypt((unsigned char*)buffer+DB_HEADER_SIZE,(unsigned char*)buffer+DB_HEADER_SIZE,total_size-DB_HEADER_SIZE,(unsigned char*)EncryptionIV);
|
||||
|
@ -566,7 +568,7 @@ StdEntry entry;
|
|||
|
||||
bRet = readEntryField(&entry,FieldType,FieldSize,(quint8*)pField);
|
||||
|
||||
if((FieldType == 0xFFFF) && (bRet == true)){
|
||||
if((FieldType == 0xFFFF) && (bRet == true)){
|
||||
Entries << entry;
|
||||
if(!entry.GroupId)qDebug("NULL: %i, '%s'",(int)CurEntry,(char*)entry.Title.toUtf8().data());
|
||||
CurEntry++;}
|
||||
|
@ -582,7 +584,7 @@ if(!createGroupTree(Levels)){
|
|||
error=tr("Invalid group tree.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
unsigned long CurGID, g, e, z, num;
|
||||
delete [] buffer;
|
||||
|
||||
|
@ -599,7 +601,7 @@ for(int i=0;i<Entries.size();i++){
|
|||
int* EntryIndices=new int[Groups.size()];
|
||||
for(int i=0;i<Groups.size();i++)EntryIndices[i]=0;
|
||||
|
||||
for(int g=0;g<Groups.size();g++){
|
||||
for(int g=0;g<Groups.size();g++){
|
||||
for(int e=0;e<Entries.size();e++){
|
||||
if(Entries[e].GroupId==Groups[g].Id){
|
||||
Entries[e].Index=EntryIndices[g];
|
||||
|
@ -643,8 +645,8 @@ bool Kdb3Database::transformKey(quint8* src,quint8* dst,quint8* KeySeed,int roun
|
|||
aes.key256(KeySeed);
|
||||
memcpy(tmp,src,32);
|
||||
for(int i=0;i<rounds;i++){
|
||||
aes.ecb_encrypt(tmp,tmp,32);
|
||||
}
|
||||
aes.ecb_encrypt(tmp,tmp,32);
|
||||
}
|
||||
SHA256::hashBuffer(tmp,dst,32);
|
||||
return true;
|
||||
}
|
||||
|
@ -658,13 +660,13 @@ int Kdb3Database::numEntries(){
|
|||
return Entries.size();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Kdb3Database::deleteGroup(StdGroup* group){
|
||||
|
||||
|
||||
while(group->Childs.size())
|
||||
deleteGroup(group->Childs.front());
|
||||
|
||||
|
||||
QList<IEntryHandle*> GroupEntries;
|
||||
GroupEntries=entries(group->Handle);
|
||||
deleteEntries(GroupEntries);
|
||||
|
@ -672,22 +674,22 @@ void Kdb3Database::deleteGroup(StdGroup* group){
|
|||
Q_ASSERT(group==group->Parent->Childs[group->Index]);
|
||||
group->Parent->Childs.removeAt(group->Index);
|
||||
for(int i=group->Index;i<group->Parent->Childs.size();i++){
|
||||
group->Parent->Childs[i]->Index--;
|
||||
group->Parent->Childs[i]->Index--;
|
||||
}
|
||||
group->Handle->invalidate();
|
||||
|
||||
|
||||
for(int i=0;i<Groups.size();i++){
|
||||
if(&Groups[i]==group){
|
||||
Groups.removeAt(i);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Kdb3Database::deleteGroup(IGroupHandle* group){
|
||||
deleteGroup(((GroupHandle*)group)->Group);
|
||||
deleteGroup(((GroupHandle*)group)->Group);
|
||||
}
|
||||
|
||||
void Kdb3Database::GroupHandle::setIndex(int index){
|
||||
|
@ -707,14 +709,14 @@ void Kdb3Database::GroupHandle::setIndex(int index){
|
|||
else{
|
||||
for(NewPos;NewPos<pDB->Groups.size();NewPos++){
|
||||
if(pDB->Groups[NewPos].ParentId==ParentId && pDB->Groups[NewPos].Index+1==index)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
//skip the childs of the found sibling
|
||||
for(NewPos;NewPos<Groups.size();NewPos++){
|
||||
if(Groups[NewPos]
|
||||
pDB->Groups.move(Pos,NewPos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// adjust the indices
|
||||
int NewIndex=0;
|
||||
|
@ -722,7 +724,7 @@ void Kdb3Database::GroupHandle::setIndex(int index){
|
|||
if(pDB->Groups[i].ParentId==ParentId){
|
||||
pDB->Groups[i].Index=NewIndex;
|
||||
NewIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -747,7 +749,7 @@ void Kdb3Database::authByPwd(QString& Password){
|
|||
return;
|
||||
}
|
||||
SHA256::hashBuffer(Password.toUtf8().data(),RawMasterKey,Password.toUtf8().size());
|
||||
return;
|
||||
return;
|
||||
}*/
|
||||
|
||||
void Kdb3Database::authByPwd(QString& Password){
|
||||
|
@ -761,7 +763,7 @@ void Kdb3Database::authByPwd(QString& Password){
|
|||
lat=Password.toLatin1();
|
||||
char *Lat=lat.data();
|
||||
char *Utf=utf.data();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Kdb3Database::authByFile(QString& filename){
|
||||
|
@ -770,17 +772,17 @@ bool Kdb3Database::authByFile(QString& filename){
|
|||
error=decodeFileError(file.error());
|
||||
return false;
|
||||
}
|
||||
unsigned long FileSize=file.size();
|
||||
unsigned long FileSize=file.size();
|
||||
if(FileSize == 0){
|
||||
error=tr("Key file is empty.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if(FileSize == 32){
|
||||
if(file.read((char*)RawMasterKey,32) != 32){
|
||||
error=decodeFileError(file.error());
|
||||
return false;}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(FileSize == 64){
|
||||
char hex[64];
|
||||
if(file.read(hex,64) != 64){
|
||||
|
@ -798,7 +800,7 @@ bool Kdb3Database::authByFile(QString& filename){
|
|||
if(read != 2048) break;
|
||||
}
|
||||
sha.finish(RawMasterKey);
|
||||
delete [] buffer;
|
||||
delete [] buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -809,7 +811,7 @@ bool Kdb3Database::authByFileAndPwd(QString& Password, QString& filename){
|
|||
memcpy(FileKey,RawMasterKey,32);
|
||||
authByPwd(Password);
|
||||
memcpy(PasswordKey,RawMasterKey,32);
|
||||
|
||||
|
||||
SHA256 sha;
|
||||
sha.update(PasswordKey,32);
|
||||
sha.update(FileKey,32);
|
||||
|
@ -822,7 +824,7 @@ QList<IEntryHandle*> Kdb3Database::entries(){
|
|||
for(int i=0; i<EntryHandles.size(); i++){
|
||||
if(EntryHandles[i].isValid())handles.append(&EntryHandles[i]);
|
||||
}
|
||||
return handles;
|
||||
return handles;
|
||||
}
|
||||
|
||||
QList<IEntryHandle*> Kdb3Database::expiredEntries(){
|
||||
|
@ -833,7 +835,7 @@ QList<IEntryHandle*> Kdb3Database::expiredEntries(){
|
|||
(EntryHandles[i].expire()!=Date_Never))
|
||||
handles.append(&EntryHandles[i]);
|
||||
}
|
||||
return handles;
|
||||
return handles;
|
||||
}
|
||||
|
||||
QList<IEntryHandle*> Kdb3Database::entries(IGroupHandle* group){
|
||||
|
@ -850,19 +852,19 @@ QList<IEntryHandle*> Kdb3Database::entries(IGroupHandle* group){
|
|||
|
||||
void Kdb3Database::deleteEntry(IEntryHandle* entry){
|
||||
if(!entry)return;
|
||||
StdGroup* Group=((EntryHandle*)entry)->Entry->Group;
|
||||
StdGroup* Group=((EntryHandle*)entry)->Entry->Group;
|
||||
int j;
|
||||
for(j=0;j<Entries.size();j++){
|
||||
if(&Entries[j]==((EntryHandle*)entry)->Entry)
|
||||
break;
|
||||
}
|
||||
Entries[j].Handle->invalidate();
|
||||
Entries.removeAt(j);
|
||||
Entries.removeAt(j);
|
||||
}
|
||||
|
||||
void Kdb3Database::moveEntry(IEntryHandle* entry, IGroupHandle* group){
|
||||
((EntryHandle*)entry)->Entry->GroupId=((GroupHandle*)group)->Group->Id;
|
||||
((EntryHandle*)entry)->Entry->Group=((GroupHandle*)group)->Group;
|
||||
((EntryHandle*)entry)->Entry->Group=((GroupHandle*)group)->Group;
|
||||
}
|
||||
|
||||
|
||||
|
@ -879,7 +881,7 @@ void Kdb3Database::deleteEntries(QList<IEntryHandle*> entries){
|
|||
Entries[j].Handle->invalidate();
|
||||
Entries.removeAt(j);
|
||||
}
|
||||
|
||||
|
||||
for(int i=0;i<Group->Childs.size();i++){
|
||||
Group->Childs[i]->Index=i;
|
||||
}
|
||||
|
@ -890,7 +892,7 @@ QList<IGroupHandle*> Kdb3Database::groups(){
|
|||
for(int i=0; i<GroupHandles.size(); i++){
|
||||
if(GroupHandles[i].isValid())handles.append(&GroupHandles[i]);
|
||||
}
|
||||
return handles;
|
||||
return handles;
|
||||
}
|
||||
|
||||
quint32 Kdb3Database::getNewGroupId(){
|
||||
|
@ -904,7 +906,7 @@ quint32 Kdb3Database::getNewGroupId(){
|
|||
if(Groups[j].Id==id)used=true;}
|
||||
if(used==false)break;
|
||||
}
|
||||
return id;
|
||||
return id;
|
||||
}
|
||||
|
||||
IGroupHandle* Kdb3Database::addGroup(const CGroup* group,IGroupHandle* ParentHandle){
|
||||
|
@ -921,7 +923,7 @@ IGroupHandle* Kdb3Database::addGroup(const CGroup* group,IGroupHandle* ParentHan
|
|||
else{
|
||||
Groups.back().Parent=&RootGroup;
|
||||
Groups.back().Index=RootGroup.Childs.size();
|
||||
Groups.back().Parent->Childs.append(&Groups.back());
|
||||
Groups.back().Parent->Childs.append(&Groups.back());
|
||||
}
|
||||
return &GroupHandles.back();
|
||||
}
|
||||
|
@ -931,7 +933,7 @@ Kdb3Database::StdGroup::StdGroup(const CGroup& other){
|
|||
Index=0;
|
||||
Id=other.Id;
|
||||
Image=other.Image;
|
||||
Title=other.Title;
|
||||
Title=other.Title;
|
||||
}
|
||||
|
||||
void Kdb3Database::EntryHandle::setTitle(const QString& Title){Entry->Title=Title; }
|
||||
|
@ -977,7 +979,6 @@ void Kdb3Database::EntryHandle::setVisualIndex(int index){
|
|||
|
||||
Kdb3Database::EntryHandle::EntryHandle(Kdb3Database* db){
|
||||
pDB=db;
|
||||
ListIndex=0;
|
||||
valid=true;
|
||||
}
|
||||
|
||||
|
@ -995,10 +996,10 @@ void Kdb3Database::GroupHandle::setImage(const quint32& New)
|
|||
{
|
||||
if(Group->Image < pDB->builtinIcons() && New >= pDB->builtinIcons())
|
||||
Group->OldImage=Group->Image;
|
||||
|
||||
|
||||
if(New < pDB->builtinIcons())
|
||||
Group->OldImage=New;
|
||||
|
||||
|
||||
Group->Image=New;
|
||||
}
|
||||
|
||||
|
@ -1018,7 +1019,7 @@ int Kdb3Database::GroupHandle::level(){
|
|||
StdGroup* group=Group;
|
||||
while(group->Parent){
|
||||
group=group->Parent;
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
i--;
|
||||
return i;
|
||||
|
@ -1112,7 +1113,7 @@ bool Kdb3Database::save(){
|
|||
/* ----------------------------------------------------------------------------------*/
|
||||
|
||||
unsigned int FileSize;
|
||||
|
||||
|
||||
QList<StdEntry> MetaStreams;
|
||||
MetaStreams << StdEntry();
|
||||
createCustomIconsMetaStream(&MetaStreams.back());
|
||||
|
@ -1134,7 +1135,7 @@ bool Kdb3Database::save(){
|
|||
+Entries[i].Password.length()+1
|
||||
+Entries[i].Comment.toUtf8().length()+1
|
||||
+Entries[i].BinaryDesc.toUtf8().length()+1
|
||||
+Entries[i].Binary.length();
|
||||
+Entries[i].Binary.length();
|
||||
}
|
||||
|
||||
for(int i=0; i < UnknownMetaStreams.size(); i++){
|
||||
|
@ -1143,14 +1144,14 @@ bool Kdb3Database::save(){
|
|||
+UnknownMetaStreams[i].Comment.toUtf8().length()+1
|
||||
+UnknownMetaStreams[i].Binary.length();
|
||||
}
|
||||
|
||||
|
||||
for(int i=0; i < MetaStreams.size(); i++){
|
||||
FileSize
|
||||
+=164
|
||||
+MetaStreams[i].Comment.toUtf8().length()+1
|
||||
+MetaStreams[i].Binary.length();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Round up filesize to 16-byte boundary for Rijndael/Twofish
|
||||
FileSize = (FileSize + 16) - (FileSize % 16);
|
||||
|
@ -1164,7 +1165,7 @@ bool Kdb3Database::save(){
|
|||
Version = PWM_DBVER_DW;
|
||||
NumGroups = Groups.size();
|
||||
NumEntries = Entries.size()+UnknownMetaStreams.size()+MetaStreams.size();
|
||||
|
||||
|
||||
qSort(Entries.begin(),Entries.end(),StdEntryLessThan);
|
||||
|
||||
randomize(FinalRandomSeed,16);
|
||||
|
@ -1172,7 +1173,7 @@ bool Kdb3Database::save(){
|
|||
randomize(EncryptionIV,16);
|
||||
|
||||
unsigned int pos=DB_HEADER_SIZE; // Skip the header, it will be written later
|
||||
|
||||
|
||||
serializeGroups(Groups,buffer,pos);
|
||||
serializeEntries(Entries,buffer,pos);
|
||||
serializeEntries(UnknownMetaStreams,buffer,pos);
|
||||
|
@ -1191,7 +1192,7 @@ bool Kdb3Database::save(){
|
|||
memcpyToLEnd32(buffer+120,&KeyTransfRounds);
|
||||
transformKey(RawMasterKey,MasterKey,TransfRandomSeed,KeyTransfRounds);
|
||||
quint8 FinalKey[32];
|
||||
|
||||
|
||||
SHA256 sha;
|
||||
sha.update(FinalRandomSeed,16);
|
||||
sha.update(MasterKey,32);
|
||||
|
@ -1203,7 +1204,7 @@ bool Kdb3Database::save(){
|
|||
EncryptedPartSize=((pos-DB_HEADER_SIZE)/16+1)*16;
|
||||
quint8 PadLen=EncryptedPartSize-(pos-DB_HEADER_SIZE);
|
||||
for(int i=0;i<PadLen;i++)
|
||||
((quint8*)buffer)[DB_HEADER_SIZE+EncryptedPartSize-1-i]=PadLen;
|
||||
((quint8*)buffer)[DB_HEADER_SIZE+EncryptedPartSize-1-i]=PadLen;
|
||||
AESencrypt aes;
|
||||
aes.key256(FinalKey);
|
||||
aes.cbc_encrypt((unsigned char*)buffer+DB_HEADER_SIZE,(unsigned char*)buffer+DB_HEADER_SIZE,EncryptedPartSize,(unsigned char*)EncryptionIV);
|
||||
|
@ -1250,7 +1251,7 @@ void Kdb3Database::createCustomIconsMetaStream(StdEntry* e){
|
|||
quint32 NumEntries=Entries.size();
|
||||
quint32 NumGroups=Groups.size();
|
||||
Size+=8*NumGroups+20*NumEntries;
|
||||
Size+=CustomIcons.size()*1000; // 1KB
|
||||
Size+=CustomIcons.size()*1000; // 1KB
|
||||
e->Binary.reserve(Size);
|
||||
e->Binary.resize(12);
|
||||
quint32 NumIcons=CustomIcons.size();
|
||||
|
@ -1288,7 +1289,7 @@ void Kdb3Database::createCustomIconsMetaStream(StdEntry* e){
|
|||
|
||||
QList<IGroupHandle*> Kdb3Database::sortedGroups(){
|
||||
QList<IGroupHandle*> SortedGroups;
|
||||
appendChildsToGroupList(SortedGroups,RootGroup);
|
||||
appendChildsToGroupList(SortedGroups,RootGroup);
|
||||
return SortedGroups;
|
||||
}
|
||||
|
||||
|
@ -1296,29 +1297,29 @@ QList<IGroupHandle*> Kdb3Database::sortedGroups(){
|
|||
void Kdb3Database::appendChildsToGroupList(QList<IGroupHandle*>& list,StdGroup& group){
|
||||
for(int i=0;i<group.Childs.size();i++){
|
||||
list << group.Childs[i]->Handle;
|
||||
appendChildsToGroupList(list,*group.Childs[i]);
|
||||
}
|
||||
appendChildsToGroupList(list,*group.Childs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Kdb3Database::appendChildsToGroupList(QList<StdGroup*>& list,StdGroup& group){
|
||||
for(int i=0;i<group.Childs.size();i++){
|
||||
list << group.Childs[i];
|
||||
appendChildsToGroupList(list,*group.Childs[i]);
|
||||
}
|
||||
appendChildsToGroupList(list,*group.Childs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Kdb3Database::serializeGroups(QList<StdGroup>& GroupList,char* buffer,unsigned int& pos){
|
||||
void Kdb3Database::serializeGroups(QList<StdGroup>& GroupList,char* buffer,unsigned int& pos){
|
||||
quint16 FieldType;
|
||||
quint32 FieldSize;
|
||||
quint32 Flags=0; //unused
|
||||
QList<StdGroup*>SortedGroups;
|
||||
appendChildsToGroupList(SortedGroups,RootGroup);
|
||||
appendChildsToGroupList(SortedGroups,RootGroup);
|
||||
|
||||
for(int i=0; i < SortedGroups.size(); i++){
|
||||
unsigned char Date[5];
|
||||
dateToPackedStruct5(Date_Never,Date);
|
||||
dateToPackedStruct5(Date_Never,Date);
|
||||
quint16 Level=0;
|
||||
StdGroup* group=SortedGroups[i];
|
||||
while(group->Parent){
|
||||
|
@ -1326,7 +1327,7 @@ void Kdb3Database::serializeGroups(QList<StdGroup>& GroupList,char* buffer,unsig
|
|||
group=group->Parent;
|
||||
}
|
||||
Level--;
|
||||
|
||||
|
||||
FieldType = 0x0001; FieldSize = 4;
|
||||
memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
|
||||
memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
|
||||
|
@ -1375,8 +1376,8 @@ void Kdb3Database::serializeGroups(QList<StdGroup>& GroupList,char* buffer,unsig
|
|||
FieldType = 0xFFFF; FieldSize = 0;
|
||||
memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
|
||||
memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1469,11 +1470,11 @@ void Kdb3Database::serializeEntries(QList<StdEntry>& EntryList,char* buffer,unsi
|
|||
FieldType = 0xFFFF; FieldSize = 0;
|
||||
memcpyToLEnd16(buffer+pos, &FieldType); pos += 2;
|
||||
memcpyToLEnd32(buffer+pos, &FieldSize); pos += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Kdb3Database::close(){
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Kdb3Database::create(){
|
||||
|
@ -1489,7 +1490,7 @@ void Kdb3Database::create(){
|
|||
bool Kdb3Database::isKeyError(){
|
||||
if(KeyError){
|
||||
KeyError=false;
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
@ -1502,7 +1503,7 @@ IEntryHandle* Kdb3Database::cloneEntry(const IEntryHandle* entry){
|
|||
Entries.append(dolly);
|
||||
EntryHandles.append(EntryHandle(this));
|
||||
EntryHandles.back().Entry=&Entries.back();
|
||||
Entries.back().Handle=&EntryHandles.back();
|
||||
Entries.back().Handle=&EntryHandles.back();
|
||||
return &EntryHandles.back();
|
||||
}
|
||||
|
||||
|
@ -1514,7 +1515,7 @@ IEntryHandle* Kdb3Database::newEntry(IGroupHandle* group){
|
|||
Entries.append(Entry);
|
||||
EntryHandles.append(EntryHandle(this));
|
||||
EntryHandles.back().Entry=&Entries.back();
|
||||
Entries.back().Handle=&EntryHandles.back();
|
||||
Entries.back().Handle=&EntryHandles.back();
|
||||
return &EntryHandles.back();
|
||||
}
|
||||
|
||||
|
@ -1526,7 +1527,7 @@ IEntryHandle* Kdb3Database::addEntry(const CEntry* NewEntry, IGroupHandle* Group
|
|||
Entries.append(Entry);
|
||||
EntryHandles.append(EntryHandle(this));
|
||||
EntryHandles.back().Entry=&Entries.back();
|
||||
Entries.back().Handle=&EntryHandles.back();
|
||||
Entries.back().Handle=&EntryHandles.back();
|
||||
return &EntryHandles.back();
|
||||
}
|
||||
|
||||
|
@ -1539,47 +1540,47 @@ bool Kdb3Database::isParent(IGroupHandle* parent, IGroupHandle* child){
|
|||
StdGroup* group=((GroupHandle*)child)->Group;
|
||||
while(group->Parent!=&RootGroup){
|
||||
if(group->Parent==((GroupHandle*)parent)->Group)return true;
|
||||
group=group->Parent;
|
||||
group=group->Parent;
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Kdb3Database::cleanUpHandles(){}
|
||||
|
||||
void Kdb3Database::cleanUpHandles(){}
|
||||
|
||||
bool Kdb3Database::searchStringContains(const QString& search, const QString& string,bool Cs, bool RegExp){
|
||||
if(RegExp){
|
||||
QRegExp exp(search,Cs ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||
if(string.contains(exp)==0)return false;}
|
||||
else
|
||||
if(string.contains(search,Cs ? Qt::CaseSensitive : Qt::CaseInsensitive)==0)return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Kdb3Database::getEntriesRecursive(IGroupHandle* Group, QList<IEntryHandle*>& EntryList){
|
||||
EntryList<<entries(Group);
|
||||
for(int i=0;i<((GroupHandle*)Group)->Group->Childs.size(); i++){
|
||||
getEntriesRecursive(((GroupHandle*)Group)->Group->Childs[i]->Handle,EntryList);
|
||||
}
|
||||
getEntriesRecursive(((GroupHandle*)Group)->Group->Childs[i]->Handle,EntryList);
|
||||
}
|
||||
}
|
||||
|
||||
QList<IEntryHandle*> Kdb3Database::search(IGroupHandle* Group,const QString& search, bool CaseSensitive, bool RegExp, bool Recursive,bool* Fields){
|
||||
bool fields[6]={true,true,true,false,true,true};
|
||||
if(!Fields)
|
||||
Fields=fields;
|
||||
Fields=fields;
|
||||
QList<IEntryHandle*> SearchEntries;
|
||||
if(search==QString())return Group ? entries(Group) : entries();
|
||||
if(Group){
|
||||
if(Recursive)
|
||||
if(Recursive)
|
||||
getEntriesRecursive(Group,SearchEntries);
|
||||
else
|
||||
SearchEntries=entries(Group);
|
||||
SearchEntries=entries(Group);
|
||||
}
|
||||
else
|
||||
SearchEntries=entries();
|
||||
|
||||
|
||||
for(int i=0;i<SearchEntries.size();i++){
|
||||
bool match=false;
|
||||
if(Fields[0])match=match||searchStringContains(search,SearchEntries[i]->title(),CaseSensitive,RegExp);
|
||||
|
@ -1595,14 +1596,14 @@ QList<IEntryHandle*> Kdb3Database::search(IGroupHandle* Group,const QString& sea
|
|||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return SearchEntries;
|
||||
}
|
||||
|
||||
void Kdb3Database::rebuildIndices(QList<StdGroup*>& list){
|
||||
for(int i=0;i<list.size();i++){
|
||||
list[i]->Index=i;
|
||||
}
|
||||
list[i]->Index=i;
|
||||
}
|
||||
}
|
||||
|
||||
bool Kdb3Database::createKeyFile(const QString& filename,int length, bool Hex){
|
||||
|
@ -1624,14 +1625,14 @@ bool Kdb3Database::createKeyFile(const QString& filename,int length, bool Hex){
|
|||
else key[i]='0'+dig1;
|
||||
if(dig2>9)key[i+1]='A'+dig2-10;
|
||||
else key[i+1]='0'+dig2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(file.write((char*)key,length)==-1){
|
||||
delete [] key;
|
||||
error=decodeFileError(file.error());
|
||||
file.close();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
file.close();
|
||||
delete [] key;
|
||||
return true;
|
||||
|
@ -1639,7 +1640,7 @@ bool Kdb3Database::createKeyFile(const QString& filename,int length, bool Hex){
|
|||
|
||||
|
||||
void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,int Pos){
|
||||
StdGroup* Parent;
|
||||
StdGroup* Parent;
|
||||
StdGroup* Group=((GroupHandle*)groupHandle)->Group;
|
||||
if(NewParent)
|
||||
Parent=((GroupHandle*)NewParent)->Group;
|
||||
|
@ -1656,22 +1657,50 @@ void Kdb3Database::moveGroup(IGroupHandle* groupHandle,IGroupHandle* NewParent,i
|
|||
Q_ASSERT(Parent->Childs.size()>=Pos);
|
||||
Parent->Childs.insert(Pos,Group);
|
||||
}
|
||||
rebuildIndices(Parent->Childs);
|
||||
rebuildIndices(Parent->Childs);
|
||||
}
|
||||
|
||||
bool Kdb3Database::changeFile(const QString& filename){
|
||||
if(File)
|
||||
if(File)
|
||||
delete File;
|
||||
if(filename==QString()){
|
||||
File=NULL;
|
||||
return true;
|
||||
}
|
||||
File=new QFile(filename);
|
||||
File=new QFile(filename);
|
||||
if(!File->open(QIODevice::ReadWrite)){
|
||||
if(!File->open(QIODevice::ReadOnly)){
|
||||
error=decodeFileError(File->error());
|
||||
error=decodeFileError(File->error());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Kdb3Database::moveToTrash(IEntryHandle* entry){
|
||||
TrashEntry trash=*((TrashEntry*)dynamic_cast<EntryHandle*>(entry)->Entry);
|
||||
IGroupHandle* CurGroup=entry->group();
|
||||
while(CurGroup){
|
||||
trash.GroupPath << CurGroup->title();
|
||||
CurGroup=CurGroup->parent();
|
||||
}
|
||||
deleteEntry(entry);
|
||||
trash.Group=NULL;
|
||||
TrashEntries.append(trash);
|
||||
TrashHandles.append(EntryHandle(this));
|
||||
TrashHandles.back().Entry=&TrashEntries.back();
|
||||
TrashEntries.back().Handle=&TrashHandles.back();
|
||||
}
|
||||
|
||||
void Kdb3Database::emptyTrash(){
|
||||
TrashEntries.clear();
|
||||
TrashHandles.clear();
|
||||
}
|
||||
|
||||
QList<IEntryHandle*> Kdb3Database::trashEntries(){
|
||||
QList<IEntryHandle*> handles;
|
||||
for(int i=0; i<TrashHandles.size();i++)
|
||||
if(TrashHandles[i].isValid())
|
||||
handles << &TrashHandles[i];
|
||||
return handles;
|
||||
}
|
|
@ -55,6 +55,7 @@ public:
|
|||
class StdGroup;
|
||||
class StdEntry;
|
||||
class EntryHandle:public IEntryHandle{
|
||||
|
||||
friend class Kdb3Database;
|
||||
public:
|
||||
EntryHandle(Kdb3Database* db);
|
||||
|
@ -94,11 +95,11 @@ public:
|
|||
private:
|
||||
void invalidate(){valid=false;}
|
||||
bool valid;
|
||||
unsigned int ListIndex;
|
||||
KpxUuid Uuid;
|
||||
//KpxUuid Uuid; ???
|
||||
Kdb3Database* pDB;
|
||||
StdEntry* Entry;
|
||||
};
|
||||
|
||||
class GroupHandle:public IGroupHandle{
|
||||
friend class Kdb3Database;
|
||||
GroupHandle(Kdb3Database* db);
|
||||
|
@ -123,8 +124,10 @@ public:
|
|||
StdGroup* Group;
|
||||
Kdb3Database* pDB;
|
||||
};
|
||||
|
||||
friend class EntryHandle;
|
||||
friend class GroupHandle;
|
||||
|
||||
class StdEntry:public CEntry{
|
||||
public:
|
||||
quint32 OldImage;
|
||||
|
@ -132,6 +135,7 @@ public:
|
|||
EntryHandle* Handle;
|
||||
StdGroup* Group;
|
||||
};
|
||||
|
||||
class StdGroup:public CGroup{
|
||||
public:
|
||||
StdGroup():CGroup(){};
|
||||
|
@ -143,6 +147,12 @@ public:
|
|||
QList<StdGroup*> Childs;
|
||||
QList<StdEntry*> Entries;
|
||||
};
|
||||
|
||||
class TrashEntry: public StdEntry{
|
||||
public:
|
||||
QStringList GroupPath;
|
||||
};
|
||||
|
||||
virtual ~Kdb3Database(){};
|
||||
virtual bool load(QString identifier);
|
||||
virtual bool save();
|
||||
|
@ -182,6 +192,9 @@ public:
|
|||
virtual IEntryHandle* addEntry(const CEntry* NewEntry, IGroupHandle* group);
|
||||
virtual void moveEntry(IEntryHandle* entry, IGroupHandle* group);
|
||||
virtual void deleteLastEntry();
|
||||
virtual void moveToTrash(IEntryHandle* entry);
|
||||
virtual QList<IEntryHandle*> trashEntries();
|
||||
virtual void emptyTrash();
|
||||
|
||||
|
||||
virtual QList<IGroupHandle*> groups();
|
||||
|
@ -232,8 +245,10 @@ private:
|
|||
|
||||
QList<EntryHandle> EntryHandles;
|
||||
QList<GroupHandle> GroupHandles;
|
||||
QList<EntryHandle> TrashHandles;
|
||||
QList<StdEntry> Entries;
|
||||
QList<StdGroup> Groups;
|
||||
QList<TrashEntry> TrashEntries;
|
||||
StdGroup RootGroup;
|
||||
QList<QPixmap>CustomIcons;
|
||||
QFile* File;
|
|
@ -32,7 +32,7 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
|
|||
setupUi(this);
|
||||
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("KeePassX %1").arg(KEEPASS_VERSION),width());
|
||||
loadLicFromFile();
|
||||
|
||||
|
||||
QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation");
|
||||
if(TrActive){
|
||||
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
|
||||
|
@ -58,6 +58,9 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
|
|||
str+="<br>";
|
||||
str+="</div><div style='margin-left:10px;'>";
|
||||
str+="<u>"+tr("James Nicholls")+"</u><br>"+tr("Main Application Icon")/*+"<br>"+tr("mailto:???")*/+"<br></div>";
|
||||
str+="<br>";
|
||||
str+="</div><div style='margin-left:10px;'>";
|
||||
str+="<u>"+tr("Constantin Makshin")+"</u><br>"+tr("Various fixes and improvements")+"<br>"+tr("dinosaur-rus@users.sourceforge.net")+"<br></div>";
|
||||
Edit_Thanks->setHtml(str);
|
||||
}
|
||||
|
||||
|
@ -85,7 +88,7 @@ return;
|
|||
|
||||
if(!gpl.open(QIODevice::ReadOnly)){
|
||||
QMessageBox::critical(this,tr("Error"),tr("Could not open file '%1'")
|
||||
.arg("'license.txt'")+tr("The following error occured:\n%1").arg(gpl.errorString())
|
||||
.arg("'license.txt'")+tr("The following error occured:\n%1").arg(gpl.errorString())
|
||||
,tr("OK"),0,0,2,1);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
CollectEntropyDlg::CollectEntropyDlg(QWidget* parent):QDialog(parent){
|
||||
setupUi(this);
|
||||
resize(layout()->closestAcceptableSize(this,QSize(0,0)));
|
||||
setMinimumSize(size());
|
||||
setMaximumSize(size());
|
||||
createBanner(&BannerPixmap,getPixmap("dice"),tr("Entropy Collection"),width());
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include <qpushbutton.h>
|
||||
#include <qpalette.h>
|
||||
#include <qfont.h>
|
||||
|
@ -69,7 +69,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
|||
connect(Button_CustomIcons,SIGNAL(clicked()),this,SLOT(OnCustomIcons()));
|
||||
connect(ExpirePresetsMenu,SIGNAL(triggered(QAction*)),this,SLOT(OnExpirePreset(QAction*)));
|
||||
connect(ButtonExpirePresets,SIGNAL(triggered(QAction*)),this,SLOT(OnCalendar(QAction*)));
|
||||
|
||||
|
||||
// QAction::data() contains the time until expiration in days.
|
||||
ExpirePresetsMenu->addAction(tr("Today"))->setData(0);
|
||||
ExpirePresetsMenu->addSeparator();
|
||||
|
@ -84,7 +84,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
|||
ExpirePresetsMenu->addAction(tr("1 Year"))->setData(365);
|
||||
ButtonExpirePresets->setMenu(ExpirePresetsMenu);
|
||||
ButtonExpirePresets->setDefaultAction(new QAction(tr("Calendar..."),ButtonExpirePresets));
|
||||
|
||||
|
||||
ButtonOpenAttachment->setIcon(getIcon("fileopen"));
|
||||
ButtonDeleteAttachment->setIcon(getIcon("filedelete"));
|
||||
ButtonSaveAttachment->setIcon(getIcon("filesave"));
|
||||
|
@ -101,7 +101,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
|||
Edit_Password->setText(Password.string());
|
||||
Edit_Password_w->setText(Password.string());
|
||||
Password.lock();
|
||||
if(!config.ShowPasswords)
|
||||
if(!config->showPasswords())
|
||||
ChangeEchoMode();
|
||||
OnPasswordwLostFocus();
|
||||
int bits=(Password.length()*8);
|
||||
|
@ -118,15 +118,15 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
|||
ButtonSaveAttachment->setDisabled(true);
|
||||
ButtonDeleteAttachment->setDisabled(true);
|
||||
Label_AttachmentSize->setText("");
|
||||
}
|
||||
}
|
||||
else{
|
||||
QString unit;
|
||||
int faktor;
|
||||
int prec;
|
||||
if(entry->binarySize()<1000){unit=" Byte";faktor=1;prec=0;}
|
||||
else
|
||||
else
|
||||
if(entry->binarySize()<1000000){unit=" kB";faktor=1000;prec=1;}
|
||||
else{unit=" MB";faktor=1000000;prec=1;}
|
||||
else{unit=" MB";faktor=1000000;prec=1;}
|
||||
Label_AttachmentSize->setText(QString::number((float)entry->binarySize()/(float)faktor,'f',prec)+unit);
|
||||
}
|
||||
if(entry->expire()==Date_Never){
|
||||
|
@ -135,7 +135,7 @@ CEditEntryDlg::CEditEntryDlg(IDatabase* _db, IEntryHandle* _entry,QWidget* paren
|
|||
}
|
||||
else{
|
||||
DateTime_Expire->setDateTime(entry->expire());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CEditEntryDlg::~CEditEntryDlg()
|
||||
|
@ -183,9 +183,9 @@ void CEditEntryDlg::InitGroupComboBox(){
|
|||
Combo_Group->insertItem(i,db->icon(groups[i]->image()),Space+groups[i]->title());
|
||||
if(groups[i]==entry->group()){
|
||||
Combo_Group->setCurrentIndex(i);
|
||||
GroupIndex=i;
|
||||
GroupIndex=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEditEntryDlg::OnButtonOK()
|
||||
|
@ -219,7 +219,7 @@ void CEditEntryDlg::OnButtonOK()
|
|||
password.fill('X');
|
||||
if(entry->image()!=Combo_IconPicker->currentIndex())
|
||||
ModFlag=true;
|
||||
|
||||
|
||||
if(ModFlag){
|
||||
entry->setExpire(DateTime_Expire->dateTime());
|
||||
entry->setLastAccess(QDateTime::currentDateTime());
|
||||
|
@ -238,11 +238,11 @@ void CEditEntryDlg::OnButtonOK()
|
|||
EntryMoved=true; ModFlag=true;
|
||||
}
|
||||
entry->setImage(Combo_IconPicker->currentIndex());
|
||||
|
||||
|
||||
if(ModFlag&&EntryMoved)done(2);
|
||||
else if(ModFlag)done(1);
|
||||
else done(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CEditEntryDlg::OnButtonCancel()
|
||||
|
@ -268,7 +268,7 @@ Edit_Password_w->setEchoMode(QLineEdit::Normal);
|
|||
|
||||
void CEditEntryDlg::OnPasswordTextChanged(const QString& txt)
|
||||
{
|
||||
Edit_Password_w->setText("");
|
||||
Edit_Password_w->setText(QString());
|
||||
int bits=(Edit_Password->text().length()*8);
|
||||
Label_Bits->setText(QString::number(bits)+" Bit");
|
||||
if(bits>128)bits=128;
|
||||
|
@ -307,7 +307,7 @@ else
|
|||
}
|
||||
|
||||
void CEditEntryDlg::OnNewAttachment()
|
||||
{
|
||||
{
|
||||
QString filename=QFileDialog::getOpenFileName(this,tr("Add Attachment..."),QDir::homePath());
|
||||
if(filename=="")return;
|
||||
QFile file(filename);
|
||||
|
@ -316,7 +316,7 @@ void CEditEntryDlg::OnNewAttachment()
|
|||
QMessageBox::warning(NULL,tr("Error"),tr("Could not open file."),tr("OK"));
|
||||
return;
|
||||
}
|
||||
ModFlag=true;
|
||||
ModFlag=true;
|
||||
entry->setBinary(file.readAll());
|
||||
file.close();
|
||||
QFileInfo info(filename);
|
||||
|
@ -341,7 +341,7 @@ void CEditEntryDlg::OnSaveAttachment(){
|
|||
|
||||
void CEditEntryDlg::saveAttachment(IEntryHandle* pEntry, QWidget* ParentWidget)
|
||||
{
|
||||
if(!pEntry->binarySize()){
|
||||
if(!pEntry->binarySize()){
|
||||
QMessageBox::information(NULL,tr("Error"),tr("The chosen entry has no attachment or it is empty."),tr("OK"));
|
||||
return;
|
||||
}
|
||||
|
@ -390,8 +390,8 @@ void CEditEntryDlg::OnButtonGenPw()
|
|||
{
|
||||
CGenPwDialog dlg(this,false);
|
||||
if(dlg.exec()){
|
||||
Edit_Password->setText(dlg.Edit_dest->text());
|
||||
Edit_Password_w->setText(dlg.Edit_dest->text());
|
||||
Edit_Password->setText(dlg.Edit_dest->text());
|
||||
Edit_Password_w->setText(dlg.Edit_dest->text());
|
||||
ModFlag=true;
|
||||
}
|
||||
}
|
||||
|
@ -427,6 +427,6 @@ void CEditEntryDlg::OnCalendar(QAction* action){
|
|||
CheckBox_ExpiresNever->setChecked(false);
|
||||
DateTime_Expire->setDate(dlg.calendarWidget->selectedDate());
|
||||
DateTime_Expire->setTime(QTime(0,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <QPixmap>
|
||||
#include <QShowEvent>
|
||||
#include "main.h"
|
||||
#include "StandardDatabase.h"
|
||||
#include "Kdb3Database.h"
|
||||
|
||||
class CEditEntryDlg : public QDialog, public Ui_EditEntryDialog
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <QStringList>
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "PasswordDlg.h"
|
||||
#include "lib/FileDialogs.h"
|
||||
|
||||
|
@ -40,31 +40,33 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
|
|||
setupUi(this);
|
||||
createBanner(Banner,getPixmap("key"),tr("Database Key"));
|
||||
db=DB;
|
||||
QDir media(config.MountDir);
|
||||
QString mountDir=config->mountDir();
|
||||
QDir media(mountDir);
|
||||
if(media.exists()){
|
||||
QStringList Paths;
|
||||
Paths=media.entryList(QStringList()<<"*",QDir::Dirs);
|
||||
Paths.erase(Paths.begin()); // delete "."
|
||||
Paths.erase(Paths.begin()); // delete ".."
|
||||
for(int i=0;i<Paths.count();i++)
|
||||
Combo_Dirs->addItem(config.MountDir+Paths[i]);
|
||||
Combo_Dirs->addItem(mountDir+Paths[i]);
|
||||
}
|
||||
|
||||
|
||||
Combo_Dirs->setEditText(QString());
|
||||
if(settings->value("RememberLastKey",true).toBool() && !ChangeKeyMode){
|
||||
QString LastKeyType=settings->value("LastKeyType","").toString();
|
||||
if(LastKeyType=="KeyFile"){
|
||||
setStateKeyFileOnly();
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString())));
|
||||
}
|
||||
else if(LastKeyType=="Composite"){
|
||||
setStateBoth();
|
||||
CheckBox_Both->setChecked(true);
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastKeyFile","").toString())));
|
||||
if(config->rememberLastKey() && !ChangeKeyMode){
|
||||
switch(config->lastKeyType()){
|
||||
case KEYFILE:
|
||||
setStateKeyFileOnly();
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
|
||||
break;
|
||||
|
||||
case BOTH:
|
||||
setStateBoth();
|
||||
CheckBox_Both->setChecked(true);
|
||||
Combo_Dirs->setEditText(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastKeyLocation())));
|
||||
}
|
||||
// if(LastKeyType==Password){... is not required because it is already the default state.
|
||||
}
|
||||
|
||||
|
||||
connect( Combo_Dirs, SIGNAL( editTextChanged(const QString&) ),this, SLOT( OnComboTextChanged(const QString&)));
|
||||
connect( ButtonCancel, SIGNAL( clicked() ), this, SLOT( OnCancel() ) );
|
||||
connect( Edit_Password, SIGNAL( textChanged(const QString&) ), this, SLOT( OnPasswordChanged(const QString&) ) );
|
||||
|
@ -73,7 +75,7 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
|
|||
connect( Edit_Password, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( Edit_PasswordRep, SIGNAL( returnPressed() ), this, SLOT( OnOK() ) );
|
||||
connect( ButtonExit, SIGNAL( clicked()),this,SLOT(OnButtonExit()));
|
||||
|
||||
|
||||
ButtonExit->setVisible(ShowExitButton);
|
||||
Mode_Set=ChangeKeyMode;
|
||||
if(!ChangeKeyMode){
|
||||
|
@ -85,8 +87,8 @@ CPasswordDialog::CPasswordDialog(QWidget* parent,IDatabase* DB,bool ShowExitButt
|
|||
connect( ButtonOK, SIGNAL( clicked() ), this, SLOT( OnOK_Set() ) );
|
||||
connect( ButtonBrowse, SIGNAL( clicked() ), this, SLOT( OnButtonBrowse_Set() ) );
|
||||
}
|
||||
|
||||
if(!config.ShowPasswordsPasswordDlg)ChangeEchoModeDatabaseKey();
|
||||
|
||||
if(!config->showPasswordsPasswordDlg())ChangeEchoModeDatabaseKey();
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,16 +161,16 @@ void CPasswordDialog::OnOK(){
|
|||
password=Edit_Password->text();
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
|
||||
if(password=="" && keyfile==""){
|
||||
if(password.isEmpty() && keyfile.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
if(KeyType==BOTH){
|
||||
if(password==""){
|
||||
if(password.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a Password."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
if(keyfile==""){
|
||||
if(keyfile.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please choose a key file."),tr("OK"),"","",0,0);
|
||||
return;}
|
||||
}
|
||||
|
@ -186,7 +188,7 @@ void CPasswordDialog::OnOK(){
|
|||
if(fileinfo.isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
QFile file(keyfile+"pwsafe.key");
|
||||
if(!file.exists()){
|
||||
if(!file.exists()){
|
||||
QDir dir(keyfile);
|
||||
QStringList files;
|
||||
files=dir.entryList(QStringList()<<"*.key",QDir::Files);
|
||||
|
@ -200,13 +202,13 @@ void CPasswordDialog::OnOK(){
|
|||
Q_ASSERT(file.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;}
|
||||
return;}
|
||||
keyfile+=files[0];
|
||||
}
|
||||
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;}
|
||||
return;}
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
}
|
||||
|
@ -231,15 +233,15 @@ void CPasswordDialog::OnOK_Set(){
|
|||
return;
|
||||
}
|
||||
keyfile=Combo_Dirs->currentText();
|
||||
if(password=="" && keyfile==""){
|
||||
if(password.isEmpty() && keyfile.isEmpty()){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Please enter a password or select a key file."),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
|
||||
if(keyfile!=QString()){
|
||||
|
||||
if(!keyfile.isEmpty()){
|
||||
QFile file(keyfile);
|
||||
if(QFileInfo(file).isDir()){
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
if(keyfile.right(1)!="/")keyfile+="/";
|
||||
keyfile+="pwsafe.key";
|
||||
}
|
||||
if(file.exists()){
|
||||
|
@ -252,60 +254,55 @@ void CPasswordDialog::OnOK_Set(){
|
|||
OverwriteKeyFile=true;
|
||||
break;
|
||||
case 2:
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
|
||||
if(OverwriteKeyFile){
|
||||
if(!DbAuth->createKeyFile(keyfile,32,true)){
|
||||
QMessageBox::warning(this,tr("Error"),tr("Key file could not be created.\n%1").arg(db->getError()),tr("OK"),"","",0,0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(doAuth())done(1);
|
||||
}
|
||||
|
||||
bool CPasswordDialog::doAuth(){
|
||||
IFilePasswordAuth* DbAuth=dynamic_cast<IFilePasswordAuth*>(db);
|
||||
if(password!=QString() && keyfile==QString()){
|
||||
if(!password.isEmpty() && keyfile.isEmpty()){
|
||||
DbAuth->authByPwd(password);
|
||||
}
|
||||
if(password==QString() && keyfile!=QString()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
if(password.isEmpty() && !keyfile.isEmpty()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
if(password!=QString() && keyfile!=QString()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
|
||||
if(settings->value("RememberLastKey",true).toBool()){
|
||||
if(!password.isEmpty() && !keyfile.isEmpty()){
|
||||
if(!DbAuth->authByFile(keyfile))return false;
|
||||
}
|
||||
|
||||
if(config->rememberLastKey()){
|
||||
QString KeyLocation=keyfile;
|
||||
if(settings->value("SaveRelativePaths",true).toBool()){
|
||||
if(config->saveRelativePaths()){
|
||||
KeyLocation=KeyLocation.left(KeyLocation.lastIndexOf("/"));
|
||||
KeyLocation=makePathRelative(KeyLocation,QDir::currentPath())+keyfile.right(keyfile.length()-keyfile.lastIndexOf("/")-1);
|
||||
KeyLocation=makePathRelative(KeyLocation,QDir::currentPath())+keyfile.right(keyfile.length()-keyfile.lastIndexOf("/")-1);
|
||||
}
|
||||
settings->setValue("LastKeyFile",KeyLocation);
|
||||
if(KeyType==PASSWORD)
|
||||
settings->setValue("LastKeyType","Password");
|
||||
if(KeyType==KEYFILE)
|
||||
settings->setValue("LastKeyType","KeyFile");
|
||||
if(KeyType==BOTH)
|
||||
settings->setValue("LastKeyType","Composite");
|
||||
config->setLastKeyLocation(KeyLocation);
|
||||
config->setLastKeyType(KeyType);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnPasswordChanged(const QString &txt){
|
||||
Edit_PasswordRep->setText("");
|
||||
if(CheckBox_Both->isChecked() || txt==QString())
|
||||
Edit_PasswordRep->setText(QString());
|
||||
if(CheckBox_Both->isChecked() || txt.isEmpty())
|
||||
setStateBoth();
|
||||
else
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
|
||||
void CPasswordDialog::OnComboTextChanged(const QString& txt){
|
||||
if(CheckBox_Both->isChecked() || txt==QString())
|
||||
if(CheckBox_Both->isChecked() || txt.isEmpty())
|
||||
setStateBoth();
|
||||
else
|
||||
setStateKeyFileOnly();
|
||||
|
@ -317,17 +314,16 @@ void CPasswordDialog::OnCheckBox_BothChanged(int state){
|
|||
if(state==Qt::Checked)
|
||||
setStateBoth();
|
||||
if(state==Qt::Unchecked){
|
||||
if(Edit_Password->text()!=QString() && Combo_Dirs->currentText()!=QString()){
|
||||
if(!Edit_Password->text().isEmpty() && !Combo_Dirs->currentText().isEmpty()){
|
||||
Combo_Dirs->setEditText(QString());
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
else{
|
||||
if(Edit_Password->text()==QString())
|
||||
if(Edit_Password->text().isEmpty())
|
||||
setStateKeyFileOnly();
|
||||
else
|
||||
setStatePasswordOnly();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,17 +29,17 @@
|
|||
#include "PasswordGenDlg.h"
|
||||
#include "CollectEntropyDlg.h"
|
||||
#include "crypto/yarrow.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
|
||||
bool CGenPwDialog::EntropyCollected=false;
|
||||
|
||||
|
||||
CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
|
||||
: QDialog(parent,fl)
|
||||
{
|
||||
setupUi(this);
|
||||
setMinimumSize(size());
|
||||
setMaximumSize(size());
|
||||
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
|
||||
createBanner(&BannerPixmap,getPixmap("dice"),tr("Password Generator"),width());
|
||||
connect(ButtonGenerate,SIGNAL(clicked()),this,SLOT(OnGeneratePw()));
|
||||
connect(Radio_1,SIGNAL(toggled(bool)),this,SLOT(OnRadio1StateChanged(bool)));
|
||||
connect(Radio_2,SIGNAL(toggled(bool)),this,SLOT(OnRadio2StateChanged(bool)));
|
||||
|
@ -56,43 +56,46 @@ CGenPwDialog::CGenPwDialog(QWidget* parent, bool StandAloneMode,Qt::WFlags fl)
|
|||
connect(Check_CollectEntropy,SIGNAL(stateChanged(int)),this,SLOT(OnCollectEntropyChanged(int)));
|
||||
connect(Edit_chars,SIGNAL(textChanged(const QString&)),this,SLOT(estimateQuality()));
|
||||
connect(Edit_chars,SIGNAL(textEdited(const QString&)),this,SLOT(OnCharsChanged(const QString&)));
|
||||
|
||||
|
||||
if(!StandAloneMode){
|
||||
AcceptButton=DialogButtons->addButton(tr("Accept"),QDialogButtonBox::AcceptRole);
|
||||
AcceptButton->setDisabled(true);
|
||||
DialogButtons->addButton(QDialogButtonBox::Cancel);
|
||||
DialogButtons->addButton(QDialogButtonBox::Cancel);
|
||||
}
|
||||
else{
|
||||
DialogButtons->addButton(tr("OK"),QDialogButtonBox::AcceptRole);
|
||||
AcceptButton=NULL;
|
||||
}
|
||||
|
||||
Radio_1->setChecked(config.PwGenOptions[0]);
|
||||
Radio_2->setChecked(!config.PwGenOptions[0]);
|
||||
checkBox1->setChecked(config.PwGenOptions[1]);
|
||||
checkBox2->setChecked(config.PwGenOptions[2]);
|
||||
checkBox3->setChecked(config.PwGenOptions[3]);
|
||||
checkBox4->setChecked(config.PwGenOptions[4]);
|
||||
checkBox5->setChecked(config.PwGenOptions[5]);
|
||||
checkBox6->setChecked(config.PwGenOptions[6]);
|
||||
checkBox7->setChecked(config.PwGenOptions[7]);
|
||||
Check_CollectEntropy->setChecked(config.PwGenOptions[8]);
|
||||
Check_CollectOncePerSession->setChecked(config.PwGenOptions[9]);
|
||||
OnRadio1StateChanged(config.PwGenOptions[0]);
|
||||
OnRadio2StateChanged(!config.PwGenOptions[0]);
|
||||
|
||||
QBitArray pwGenOptions=config->pwGenOptions();
|
||||
Radio_1->setChecked(pwGenOptions.at(0));
|
||||
Radio_2->setChecked(!pwGenOptions.at(0));
|
||||
checkBox1->setChecked(pwGenOptions.at(1));
|
||||
checkBox2->setChecked(pwGenOptions.at(2));
|
||||
checkBox3->setChecked(pwGenOptions.at(3));
|
||||
checkBox4->setChecked(pwGenOptions.at(4));
|
||||
checkBox5->setChecked(pwGenOptions.at(5));
|
||||
checkBox6->setChecked(pwGenOptions.at(6));
|
||||
checkBox7->setChecked(pwGenOptions.at(7));
|
||||
Check_CollectEntropy->setChecked(pwGenOptions.at(8));
|
||||
Check_CollectOncePerSession->setChecked(pwGenOptions.at(9));
|
||||
OnRadio1StateChanged(pwGenOptions.at(0));
|
||||
OnRadio2StateChanged(!pwGenOptions.at(0));
|
||||
}
|
||||
|
||||
CGenPwDialog::~CGenPwDialog(){
|
||||
config.PwGenOptions[0]=Radio_1->isChecked();
|
||||
config.PwGenOptions[1]=checkBox1->isChecked();
|
||||
config.PwGenOptions[2]=checkBox2->isChecked();
|
||||
config.PwGenOptions[3]=checkBox3->isChecked();
|
||||
config.PwGenOptions[4]=checkBox4->isChecked();
|
||||
config.PwGenOptions[5]=checkBox5->isChecked();
|
||||
config.PwGenOptions[6]=checkBox6->isChecked();
|
||||
config.PwGenOptions[7]=checkBox7->isChecked();
|
||||
config.PwGenOptions[8]=Check_CollectEntropy->isChecked();
|
||||
config.PwGenOptions[9]=Check_CollectOncePerSession->isChecked();
|
||||
QBitArray pwGenOptions(10);
|
||||
pwGenOptions.setBit(0,Radio_1->isChecked());
|
||||
pwGenOptions.setBit(1,checkBox1->isChecked());
|
||||
pwGenOptions.setBit(2,checkBox2->isChecked());
|
||||
pwGenOptions.setBit(3,checkBox3->isChecked());
|
||||
pwGenOptions.setBit(4,checkBox4->isChecked());
|
||||
pwGenOptions.setBit(5,checkBox5->isChecked());
|
||||
pwGenOptions.setBit(6,checkBox6->isChecked());
|
||||
pwGenOptions.setBit(7,checkBox7->isChecked());
|
||||
pwGenOptions.setBit(8,Check_CollectEntropy->isChecked());
|
||||
pwGenOptions.setBit(9,Check_CollectOncePerSession->isChecked());
|
||||
config->setPwGenOptions(pwGenOptions);
|
||||
}
|
||||
|
||||
void CGenPwDialog::paintEvent(QPaintEvent *event){
|
||||
|
@ -129,7 +132,7 @@ void CGenPwDialog::OnRadio2StateChanged(bool state){
|
|||
Edit_chars->setEnabled(true);
|
||||
else
|
||||
Edit_chars->setDisabled(true);
|
||||
|
||||
|
||||
estimateQuality();
|
||||
}
|
||||
|
||||
|
@ -141,22 +144,22 @@ void CGenPwDialog::OnGeneratePw()
|
|||
"A...Z" 65...90
|
||||
"a...z" 97...122
|
||||
"0...9" 48...57
|
||||
Special Charakters 33...47; 58...64; 91...96; 123...126
|
||||
Special Characters 33...47; 58...64; 91...96; 123...126
|
||||
"-" 45
|
||||
"_" 95
|
||||
-------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
int num=0;
|
||||
char assoctable[255];
|
||||
|
||||
|
||||
if(Radio_1->isChecked()){
|
||||
if(checkBox1->isChecked())
|
||||
num+=AddToAssoctable(assoctable,65,90,num);
|
||||
num+=AddToAssoctable(assoctable,65,90,num);
|
||||
if(checkBox2->isChecked())
|
||||
num+=AddToAssoctable(assoctable,97,122,num);
|
||||
num+=AddToAssoctable(assoctable,97,122,num);
|
||||
if(checkBox3->isChecked())
|
||||
num+=AddToAssoctable(assoctable,48,57,num);
|
||||
num+=AddToAssoctable(assoctable,48,57,num);
|
||||
if(checkBox4->isChecked()){
|
||||
num+=AddToAssoctable(assoctable,33,47,num);
|
||||
num+=AddToAssoctable(assoctable,58,64,num);
|
||||
|
@ -173,7 +176,7 @@ void CGenPwDialog::OnGeneratePw()
|
|||
QString str=Edit_chars->text();
|
||||
for(int i=0;i<str.length();i++){
|
||||
assoctable[i]=str[i].toAscii();
|
||||
num++;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if(num==0){
|
||||
|
@ -186,7 +189,7 @@ void CGenPwDialog::OnGeneratePw()
|
|||
int length=Spin_Num->value();
|
||||
char* buffer=new char[length+1];
|
||||
buffer[length]=0;
|
||||
|
||||
|
||||
if(Check_CollectEntropy->isChecked()){
|
||||
if((Check_CollectOncePerSession->isChecked() && !EntropyCollected) || !Check_CollectOncePerSession->isChecked()){
|
||||
CollectEntropyDlg dlg(this);
|
||||
|
@ -194,21 +197,21 @@ void CGenPwDialog::OnGeneratePw()
|
|||
EntropyCollected=true;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char tmp;
|
||||
|
||||
unsigned char tmp;
|
||||
for(int i=0;i<length;i++){
|
||||
|
||||
do randomize(&tmp,1);
|
||||
|
||||
do randomize(&tmp,1);
|
||||
while(!trim(tmp,num));
|
||||
|
||||
|
||||
buffer[i]=assoctable[tmp];
|
||||
}
|
||||
|
||||
|
||||
Edit_dest->setText(buffer);
|
||||
delete [] buffer;
|
||||
if(AcceptButton)AcceptButton->setEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
int CGenPwDialog::AddToAssoctable(char* table,int start,int end,int pos){
|
||||
for(int i=start;i<=end;i++){
|
||||
table[pos]=i;
|
||||
|
@ -231,11 +234,11 @@ void CGenPwDialog::estimateQuality(){
|
|||
int num=0;
|
||||
if(Radio_1->isChecked()){
|
||||
if(checkBox1->isChecked())
|
||||
num+=26;
|
||||
num+=26;
|
||||
if(checkBox2->isChecked())
|
||||
num+=26;
|
||||
num+=26;
|
||||
if(checkBox3->isChecked())
|
||||
num+=10;
|
||||
num+=10;
|
||||
if(checkBox4->isChecked())
|
||||
num+=32;
|
||||
if(checkBox5->isChecked())
|
||||
|
@ -247,7 +250,7 @@ void CGenPwDialog::estimateQuality(){
|
|||
}
|
||||
else
|
||||
num=Edit_chars->text().length();
|
||||
|
||||
|
||||
float bits=0;
|
||||
if(num)bits=log(num)/log(2);
|
||||
bits=bits*((float)Spin_Num->value());
|
||||
|
@ -267,18 +270,18 @@ void CGenPwDialog::OnCharsChanged(const QString& str){
|
|||
else {count++;}
|
||||
}
|
||||
}
|
||||
if(multiple)break;
|
||||
if(multiple)break;
|
||||
}
|
||||
if(!multiple)return;
|
||||
|
||||
|
||||
QString newstr;
|
||||
for(int i=0;i<str.size();i++){
|
||||
if(!newstr.count(str[i])){
|
||||
newstr+=str[i];
|
||||
}
|
||||
newstr+=str[i];
|
||||
}
|
||||
}
|
||||
Edit_chars->setText(newstr);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CGenPwDialog::OnAccept()
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "SearchDlg.h"
|
||||
|
||||
|
||||
|
@ -37,16 +37,17 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
|
|||
db=database;
|
||||
group=Group;
|
||||
createBanner(&BannerPixmap,getPixmap("search"),tr("Search"),width());
|
||||
checkBox_Cs->setChecked(config.SearchOptions[0]);
|
||||
checkBox_regExp->setChecked(config.SearchOptions[1]);
|
||||
checkBox_Title->setChecked(config.SearchOptions[2]);
|
||||
checkBox_Username->setChecked(config.SearchOptions[3]);
|
||||
checkBox_Password->setChecked(config.SearchOptions[4]);
|
||||
checkBox_Comment->setChecked(config.SearchOptions[5]);
|
||||
checkBox_URL->setChecked(config.SearchOptions[6]);
|
||||
checkBox_Attachment->setChecked(config.SearchOptions[7]);
|
||||
QBitArray searchOptions=config->searchOptions();
|
||||
checkBox_Cs->setChecked(searchOptions.at(0));
|
||||
checkBox_regExp->setChecked(searchOptions.at(1));
|
||||
checkBox_Title->setChecked(searchOptions.at(2));
|
||||
checkBox_Username->setChecked(searchOptions.at(3));
|
||||
checkBox_Password->setChecked(searchOptions.at(4));
|
||||
checkBox_Comment->setChecked(searchOptions.at(5));
|
||||
checkBox_URL->setChecked(searchOptions.at(6));
|
||||
checkBox_Attachment->setChecked(searchOptions.at(7));
|
||||
if(group)
|
||||
checkBox_Recursive->setChecked(config.SearchOptions[8]);
|
||||
checkBox_Recursive->setChecked(searchOptions.at(8));
|
||||
else{
|
||||
checkBox_Recursive->setChecked(false);
|
||||
checkBox_Recursive->setEnabled(false);
|
||||
|
@ -55,15 +56,17 @@ SearchDialog::SearchDialog(IDatabase* database,IGroupHandle* Group,QWidget* pare
|
|||
|
||||
SearchDialog::~SearchDialog()
|
||||
{
|
||||
config.SearchOptions[0]=checkBox_Cs->isChecked();
|
||||
config.SearchOptions[1]=checkBox_regExp->isChecked();
|
||||
config.SearchOptions[2]=checkBox_Title->isChecked();
|
||||
config.SearchOptions[3]=checkBox_Username->isChecked();
|
||||
config.SearchOptions[4]=checkBox_Password->isChecked();
|
||||
config.SearchOptions[5]=checkBox_Comment->isChecked();
|
||||
config.SearchOptions[6]=checkBox_URL->isChecked();
|
||||
config.SearchOptions[7]=checkBox_Attachment->isChecked();
|
||||
if(group) config.SearchOptions[8]=checkBox_Recursive->isChecked();
|
||||
QBitArray searchOptions(9);
|
||||
searchOptions.setBit(0,checkBox_Cs->isChecked());
|
||||
searchOptions.setBit(1,checkBox_regExp->isChecked());
|
||||
searchOptions.setBit(2,checkBox_Title->isChecked());
|
||||
searchOptions.setBit(3,checkBox_Username->isChecked());
|
||||
searchOptions.setBit(4,checkBox_Password->isChecked());
|
||||
searchOptions.setBit(5,checkBox_Comment->isChecked());
|
||||
searchOptions.setBit(6,checkBox_URL->isChecked());
|
||||
searchOptions.setBit(7,checkBox_Attachment->isChecked());
|
||||
if(group) searchOptions.setBit(8,checkBox_Recursive->isChecked());
|
||||
config->setSearchOptions(searchOptions);
|
||||
}
|
||||
|
||||
void SearchDialog::OnClose()
|
||||
|
@ -79,7 +82,7 @@ void SearchDialog::OnSearch()
|
|||
Fields[2]=checkBox_URL->isChecked();
|
||||
Fields[3]=checkBox_Password->isChecked();
|
||||
Fields[4]=checkBox_Comment->isChecked();
|
||||
Fields[5]=checkBox_Attachment->isChecked();
|
||||
Fields[5]=checkBox_Attachment->isChecked();
|
||||
Result=db->search(group,Edit_Search->text(),checkBox_Cs->isChecked(),checkBox_regExp->isChecked(),checkBox_Recursive->isChecked(),Fields);
|
||||
done(1);
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include <qpixmap.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qspinbox.h>
|
||||
|
@ -40,92 +40,94 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
|||
connect(DialogButtons, SIGNAL( accepted() ), this, SLOT( OnOK() ) );
|
||||
connect(DialogButtons, SIGNAL( rejected() ), this, SLOT( OnCancel() ) );
|
||||
connect(DialogButtons, SIGNAL( clicked(QAbstractButton*)), this, SLOT(OnOtherButton(QAbstractButton*)));
|
||||
|
||||
|
||||
connect(ButtonColor1, SIGNAL( clicked() ), this, SLOT( OnColor1() ) );
|
||||
connect(ButtonColor2, SIGNAL( clicked() ), this, SLOT( OnColor2() ) );
|
||||
connect(ButtonTextColor, SIGNAL( clicked() ), this, SLOT( OnTextColor() ) );
|
||||
connect(CheckBox_OpenLast,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxOpenLastChanged(int)));
|
||||
connect(Button_MountDirBrowse,SIGNAL(clicked()),this,SLOT(OnMountDirBrowse()));
|
||||
|
||||
|
||||
connect(Radio_IntPlugin_None,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginNone(bool)));
|
||||
connect(Radio_IntPlugin_Gnome,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginGnome(bool)));
|
||||
connect(Radio_IntPlugin_Kde,SIGNAL(toggled(bool)),this,SLOT(OnIntPluginKde(bool)));
|
||||
|
||||
|
||||
connect(CheckBox_BrowserDefault,SIGNAL(stateChanged(int)),this,SLOT(OnCheckBoxBrowserDefaultChanged(int)));
|
||||
connect(Button_CustomizeEntryDetails,SIGNAL(clicked()),this,SLOT(OnCustomizeEntryDetails()));
|
||||
|
||||
|
||||
|
||||
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width());
|
||||
|
||||
|
||||
//General
|
||||
CheckBox_OpenLast->setChecked(settings->value("OpenLastFile",true).toBool());
|
||||
CheckBox_RememberLastKey->setChecked(settings->value("RememberLastKey",true).toBool());
|
||||
checkBox_ShowSysTrayIcon->setChecked(config.ShowSysTrayIcon);
|
||||
checkBox_MinimizeToTray->setChecked(config.MinimizeToTray);
|
||||
checkBox_SaveFileDlgHistory->setChecked(config.SaveFileDlgHistory);
|
||||
|
||||
switch(config.GroupTreeRestore){
|
||||
case 1:
|
||||
CheckBox_OpenLast->setChecked(config->openLastFile());
|
||||
CheckBox_RememberLastKey->setChecked(config->rememberLastKey());
|
||||
checkBox_ShowSysTrayIcon->setChecked(config->showSysTrayIcon());
|
||||
checkBox_MinimizeToTray->setChecked(config->minimizeToTray());
|
||||
checkBox_SaveFileDlgHistory->setChecked(config->saveFileDlgHistory());
|
||||
checkBox_AskBeforeDelete->setChecked(config->askBeforeDelete());
|
||||
|
||||
switch(config->groupTreeState()){
|
||||
case KpxConfig::RestoreLast:
|
||||
Radio_GroupTreeRestore->setChecked(true);
|
||||
break;
|
||||
case 2:
|
||||
case KpxConfig::ExpandAll:
|
||||
Radio_GroupTreeExpand->setChecked(true);
|
||||
break;
|
||||
case 3:
|
||||
default:
|
||||
Radio_GroupTreeDoNothing->setChecked(true);
|
||||
}
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="ExpandAll")Radio_GroupTreeExpand->setChecked(true);
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="Restore")Radio_GroupTreeRestore->setChecked(true);
|
||||
if(settings->value("GroupTreeState","ExpandAll")=="ExpandNone")Radio_GroupTreeDoNothing->setChecked(true);
|
||||
|
||||
|
||||
//Appearance
|
||||
|
||||
//Appearance
|
||||
QPixmap *pxt=new QPixmap(pixmTextColor->width(),pixmTextColor->height());
|
||||
pxt->fill(config.BannerTextColor);
|
||||
pxt->fill(config->bannerTextColor());
|
||||
pixmTextColor->clear();
|
||||
pixmTextColor->setPixmap(*pxt);
|
||||
|
||||
|
||||
QPixmap *px1=new QPixmap(pixmColor1->width(),pixmColor1->height());
|
||||
px1->fill(config.BannerColor1);
|
||||
px1->fill(config->bannerColor1());
|
||||
pixmColor1->clear();
|
||||
pixmColor1->setPixmap(*px1);
|
||||
|
||||
|
||||
QPixmap *px2=new QPixmap(pixmColor2->width(),pixmColor2->height());
|
||||
px2->fill(config.BannerColor2);
|
||||
px2->fill(config->bannerColor2());
|
||||
pixmColor2->clear();
|
||||
pixmColor2->setPixmap(*px2);
|
||||
|
||||
color1=config.BannerColor1;
|
||||
color2=config.BannerColor2;
|
||||
textcolor=config.BannerTextColor;
|
||||
CheckBox_AlternatingRowColors->setChecked(config.AlternatingRowColors);
|
||||
|
||||
|
||||
pixmColor2->setPixmap(*px2);
|
||||
|
||||
color1=config->bannerColor1();
|
||||
color2=config->bannerColor2();
|
||||
textcolor=config->bannerTextColor();
|
||||
CheckBox_AlternatingRowColors->setChecked(config->alternatingRowColors());
|
||||
|
||||
|
||||
//Security
|
||||
SpinBox_ClipboardTime->setValue(config.ClipboardTimeOut);
|
||||
CheckBox_ShowPasswords->setChecked(config.ShowPasswords);
|
||||
CheckBox_ShowPasswords_PasswordDlg->setChecked(config.ShowPasswordsPasswordDlg);
|
||||
|
||||
|
||||
SpinBox_ClipboardTime->setValue(config->clipboardTimeOut());
|
||||
CheckBox_ShowPasswords->setChecked(config->showPasswords());
|
||||
CheckBox_ShowPasswords_PasswordDlg->setChecked(config->showPasswordsPasswordDlg());
|
||||
|
||||
|
||||
//Desktop Integration
|
||||
if(PluginLoadError==QString())
|
||||
Label_IntPlugin_Error->hide();
|
||||
else
|
||||
Label_IntPlugin_Error->setText(QString("<html><p style='font-weight:600; color:#8b0000;'>%1</p></body></html>")
|
||||
.arg(tr("Error: %1")).arg(PluginLoadError));
|
||||
|
||||
switch(config.IntegrPlugin){
|
||||
case CConfig::NONE: Radio_IntPlugin_None->setChecked(true); break;
|
||||
case CConfig::GNOME: Radio_IntPlugin_Gnome->setChecked(true); break;
|
||||
case CConfig::KDE: Radio_IntPlugin_Kde->setChecked(true); break;
|
||||
.arg(tr("Error: %1")).arg(PluginLoadError));
|
||||
|
||||
switch(config->integrPlugin()){
|
||||
case KpxConfig::KDE:
|
||||
Radio_IntPlugin_Kde->setChecked(true);
|
||||
break;
|
||||
case KpxConfig::Gnome:
|
||||
Radio_IntPlugin_Gnome->setChecked(true);
|
||||
break;
|
||||
default:
|
||||
Radio_IntPlugin_None->setChecked(true);
|
||||
}
|
||||
if(!PluginsModified)
|
||||
Label_IntPlugin_Info->hide();
|
||||
|
||||
|
||||
|
||||
|
||||
//Advanced
|
||||
QString BrowserCmd=settings->value("BrowserCmd","<<default>>").toString();
|
||||
if(BrowserCmd=="<<default>>"){
|
||||
QString BrowserCmd=config->urlCmd();
|
||||
if(BrowserCmd.isEmpty()){
|
||||
CheckBox_BrowserDefault->setChecked(true);
|
||||
Edit_BrowserCmd->setDisabled(true);
|
||||
}
|
||||
|
@ -133,10 +135,10 @@ CSettingsDlg::CSettingsDlg(QWidget* parent):QDialog(parent,Qt::Dialog)
|
|||
Edit_BrowserCmd->setText(BrowserCmd);
|
||||
CheckBox_BrowserDefault->setChecked(false);
|
||||
}
|
||||
|
||||
Edit_MountDir->setText(config.MountDir);
|
||||
CheckBox_SaveRelativePaths->setChecked(settings->value("SaveRelativePaths",true).toBool());
|
||||
|
||||
|
||||
Edit_MountDir->setText(config->mountDir());
|
||||
CheckBox_SaveRelativePaths->setChecked(config->saveRelativePaths());
|
||||
|
||||
}
|
||||
|
||||
CSettingsDlg::~CSettingsDlg()
|
||||
|
@ -153,7 +155,7 @@ void CSettingsDlg::paintEvent(QPaintEvent *event){
|
|||
void CSettingsDlg::OnCheckBoxBrowserDefaultChanged(int state){
|
||||
if(state==Qt::Checked){
|
||||
Edit_BrowserCmd->setDisabled(true);
|
||||
Edit_BrowserCmd->setText("");
|
||||
Edit_BrowserCmd->setText(QString());
|
||||
}
|
||||
else{
|
||||
Edit_BrowserCmd->setDisabled(false);
|
||||
|
@ -172,51 +174,49 @@ void CSettingsDlg::OnCancel()
|
|||
}
|
||||
|
||||
void CSettingsDlg::OnOtherButton(QAbstractButton* button){
|
||||
if(DialogButtons->buttonRole(button)==QDialogButtonBox::ApplyRole)
|
||||
if(DialogButtons->buttonRole(button)==QDialogButtonBox::ApplyRole)
|
||||
apply();
|
||||
}
|
||||
|
||||
void CSettingsDlg::apply(){
|
||||
|
||||
|
||||
//General
|
||||
config.ShowSysTrayIcon=checkBox_ShowSysTrayIcon->isChecked();
|
||||
config.MinimizeToTray=checkBox_MinimizeToTray->isChecked();
|
||||
config.SaveFileDlgHistory=checkBox_SaveFileDlgHistory->isChecked();
|
||||
config.EnableBookmarkMenu=checkBox_EnableBookmarkMenu->isChecked();
|
||||
if(Radio_GroupTreeRestore->isChecked())config.GroupTreeRestore=0;
|
||||
if(Radio_GroupTreeExpand->isChecked())config.GroupTreeRestore=1;
|
||||
if(Radio_GroupTreeDoNothing->isChecked())config.GroupTreeRestore=2;
|
||||
settings->setValue("OpenLastFile",CheckBox_OpenLast->isChecked());
|
||||
settings->setValue("RememberLastKey",CheckBox_RememberLastKey->isChecked());
|
||||
if(Radio_GroupTreeExpand->isChecked())settings->setValue("GroupTreeState","ExpandAll");
|
||||
if(Radio_GroupTreeDoNothing->isChecked())settings->setValue("GroupTreeState","ExpandNone");
|
||||
if(Radio_GroupTreeRestore->isChecked())settings->setValue("GroupTreeState","Restore");
|
||||
|
||||
config->setShowSysTrayIcon(checkBox_ShowSysTrayIcon->isChecked());
|
||||
config->setMinimizeToTray(checkBox_MinimizeToTray->isChecked());
|
||||
config->setSaveFileDlgHistory(checkBox_SaveFileDlgHistory->isChecked());
|
||||
config->setEnableBookmarkMenu(checkBox_EnableBookmarkMenu->isChecked());
|
||||
if(Radio_GroupTreeRestore->isChecked())config->setGroupTreeState(KpxConfig::RestoreLast);
|
||||
else if(Radio_GroupTreeExpand->isChecked())config->setGroupTreeState(KpxConfig::ExpandAll);
|
||||
else config->setGroupTreeState(KpxConfig::DoNothing);
|
||||
config->setOpenLastFile(CheckBox_OpenLast->isChecked());
|
||||
config->setRememberLastKey(CheckBox_RememberLastKey->isChecked());
|
||||
config->setAskBeforeDelete(checkBox_AskBeforeDelete->isChecked());
|
||||
|
||||
//Appearence
|
||||
config.BannerColor1=color1;
|
||||
config.BannerColor2=color2;
|
||||
config.BannerTextColor=textcolor;
|
||||
config.AlternatingRowColors=CheckBox_AlternatingRowColors->isChecked();
|
||||
|
||||
config->setBannerColor1(color1);
|
||||
config->setBannerColor2(color2);
|
||||
config->setBannerTextColor(textcolor);
|
||||
config->setAlternatingRowColors(CheckBox_AlternatingRowColors->isChecked());
|
||||
|
||||
//Security
|
||||
config.ClipboardTimeOut=SpinBox_ClipboardTime->value();
|
||||
config.ShowPasswords=CheckBox_ShowPasswords->isChecked();
|
||||
config.ShowPasswordsPasswordDlg=CheckBox_ShowPasswords_PasswordDlg->isChecked();
|
||||
|
||||
//Desktop Integration
|
||||
config->setClipboardTimeOut(SpinBox_ClipboardTime->value());
|
||||
config->setShowPasswords(CheckBox_ShowPasswords->isChecked());
|
||||
config->setShowPasswordsPasswordDlg(CheckBox_ShowPasswords_PasswordDlg->isChecked());
|
||||
|
||||
//Desktop Integration
|
||||
PluginsModified=Label_IntPlugin_Info->isVisible();
|
||||
if(Radio_IntPlugin_None->isChecked())config.IntegrPlugin=CConfig::NONE;
|
||||
if(Radio_IntPlugin_Gnome->isChecked())config.IntegrPlugin=CConfig::GNOME;
|
||||
if(Radio_IntPlugin_Kde->isChecked())config.IntegrPlugin=CConfig::KDE;
|
||||
|
||||
if(Radio_IntPlugin_Kde->isChecked())config->setIntegrPlugin(KpxConfig::KDE);
|
||||
else if(Radio_IntPlugin_Gnome->isChecked())config->setIntegrPlugin(KpxConfig::Gnome);
|
||||
else config->setIntegrPlugin(KpxConfig::NoIntegr);
|
||||
|
||||
//Advanced
|
||||
config.OpenUrlCommand=Edit_BrowserCmd->text();
|
||||
config.MountDir=Edit_MountDir->text();
|
||||
if(config.MountDir!="" && config.MountDir.right(1)!="/")
|
||||
config.MountDir+="/";
|
||||
if(CheckBox_BrowserDefault->isChecked())settings->setValue("BrowserCmd","<<default>>");
|
||||
else settings->setValue("BrowserCmd",Edit_BrowserCmd->text());
|
||||
settings->setValue("SaveRelativePaths",CheckBox_SaveRelativePaths->isChecked());
|
||||
config->setUrlCmd(Edit_BrowserCmd->text());
|
||||
config->setMountDir(Edit_MountDir->text());
|
||||
if(!config->mountDir().isEmpty() && config->mountDir().right(1)!="/")
|
||||
config->setMountDir(config->mountDir()+"/");
|
||||
if(CheckBox_BrowserDefault->isChecked())config->setUrlCmd(QString());
|
||||
else config->setUrlCmd(Edit_BrowserCmd->text());
|
||||
config->setSaveRelativePaths(CheckBox_SaveRelativePaths->isChecked());
|
||||
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ void CSettingsDlg::OnTextColor()
|
|||
pixmTextColor->clear();
|
||||
pixmTextColor->setPixmap(*px);
|
||||
createBanner(&BannerPixmap,getPixmap("appsettings"),tr("Settings"),width(),color1,color2,textcolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -292,5 +292,5 @@ void CSettingsDlg::OnIntPluginKde(bool toggled){
|
|||
|
||||
void CSettingsDlg::OnCustomizeEntryDetails(){
|
||||
CustomizeDetailViewDialog dlg(this);
|
||||
dlg.exec();
|
||||
dlg.exec();
|
||||
}
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "SimplePasswordDlg.h"
|
||||
|
||||
SimplePasswordDialog::SimplePasswordDialog(QWidget* parent, bool modal, Qt::WFlags fl)
|
||||
: QDialog(parent,fl)
|
||||
{
|
||||
setupUi(this);
|
||||
if(!config.ShowPasswords)Button_HidePassword->toggle();
|
||||
if(!config->showPasswords())Button_HidePassword->toggle();
|
||||
connect(buttonBox->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(OnOK()));
|
||||
connect(buttonBox->button(QDialogButtonBox::Cancel),SIGNAL(clicked()),this,SLOT(OnCancel()));
|
||||
connect(Button_HidePassword,SIGNAL(toggled(bool)),this,SLOT(OnHidePasswordToggled(bool)));
|
||||
|
@ -42,9 +42,9 @@ SimplePasswordDialog::~SimplePasswordDialog()
|
|||
|
||||
void SimplePasswordDialog::OnTextChanged(const QString& txt){
|
||||
if(txt==QString())
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
else
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
}
|
||||
|
||||
void SimplePasswordDialog::OnCancel()
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>230</height>
|
||||
<height>316</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>4</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -51,6 +51,14 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>4</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Collecting entropy...
|
||||
Please move the mouse and/or press some keys until enought entropy for a reseed of the random number generator is collected.</string>
|
||||
|
@ -81,7 +89,7 @@ Please move the mouse and/or press some keys until enought entropy for a reseed
|
|||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -89,7 +97,13 @@ Please move the mouse and/or press some keys until enought entropy for a reseed
|
|||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>45</height>
|
||||
<height>46</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>46</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="currentIndex" >
|
||||
|
|
|
@ -18,12 +18,21 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="centralWidget" >
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="HSplitter" >
|
||||
<property name="orientation" >
|
||||
|
@ -31,9 +40,7 @@
|
|||
</property>
|
||||
<widget class="QSplitter" name="VSplitter" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>60</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -46,9 +53,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>30</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -68,9 +73,7 @@
|
|||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>70</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -83,14 +86,12 @@
|
|||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="DetailView" >
|
||||
<widget class="QTextBrowser" name="DetailView" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>7</vsizetype>
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>10</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -104,6 +105,9 @@
|
|||
<property name="readOnly" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openLinks" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -221,8 +225,10 @@
|
|||
<string>E&xtras</string>
|
||||
</property>
|
||||
<addaction name="ExtrasSettingsAction" />
|
||||
<addaction name="ExtrasShowExpiredEntriesAction" />
|
||||
<addaction name="ExtrasPasswordGenAction" />
|
||||
<addaction name="separator" />
|
||||
<addaction name="ExtrasShowExpiredEntriesAction" />
|
||||
<addaction name="ExtrasTrashCanAction" />
|
||||
</widget>
|
||||
<addaction name="menuDatei" />
|
||||
<addaction name="menuBearbeiten" />
|
||||
|
@ -533,6 +539,11 @@
|
|||
<string>Show Expired Entries</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="ExtrasTrashCanAction" >
|
||||
<property name="text" >
|
||||
<string>Recycle Bin...</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
@ -28,12 +28,21 @@
|
|||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
|
@ -69,12 +78,6 @@
|
|||
<string>General</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_ShowSysTrayIcon" >
|
||||
<property name="text" >
|
||||
|
@ -91,12 +94,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox_OpenLast" >
|
||||
<property name="text" >
|
||||
|
@ -147,12 +159,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_SaveFileDlgHistory" >
|
||||
<property name="text" >
|
||||
|
@ -179,7 +200,7 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="Button_ClearFileDlgHistory" >
|
||||
<property name="text" >
|
||||
<string>Clear</string>
|
||||
<string>Clear History Now</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -199,73 +220,71 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_EnableBookmarkMenu" >
|
||||
<widget class="QCheckBox" name="checkBox_AskBeforeDelete" >
|
||||
<property name="text" >
|
||||
<string>Enable bookmark menu</string>
|
||||
<string>Always ask before deleting entries or groups</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Group tree at start-up:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QRadioButton" name="Radio_GroupTreeRestore" >
|
||||
<property name="text" >
|
||||
<string>Restore last state</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QRadioButton" name="Radio_GroupTreeExpand" >
|
||||
<property name="text" >
|
||||
<string>Expand all items</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QRadioButton" name="Radio_GroupTreeDoNothing" >
|
||||
<property name="text" >
|
||||
<string>Do not expand any item</string>
|
||||
|
@ -296,8 +315,8 @@
|
|||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>531</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
@ -309,30 +328,60 @@
|
|||
<string>Appea&rance</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox1" >
|
||||
<property name="title" >
|
||||
<string>Banner Color</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
|
@ -361,9 +410,7 @@
|
|||
<item row="1" column="2" >
|
||||
<widget class="QPushButton" name="ButtonTextColor" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -391,9 +438,7 @@
|
|||
<item row="0" column="4" >
|
||||
<widget class="QLabel" name="textLabel3" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -406,9 +451,7 @@
|
|||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="pixmColor1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -433,9 +476,7 @@
|
|||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="pixmTextColor" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -463,9 +504,7 @@
|
|||
<item row="0" column="6" >
|
||||
<widget class="QPushButton" name="ButtonColor2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -493,9 +532,7 @@
|
|||
<item row="0" column="5" >
|
||||
<widget class="QLabel" name="pixmColor2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -523,9 +560,7 @@
|
|||
<item row="0" column="2" >
|
||||
<widget class="QPushButton" name="ButtonColor1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -553,9 +588,7 @@
|
|||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="textLabel1_3" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -602,12 +635,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="Button_CustomizeEntryDetails" >
|
||||
<property name="text" >
|
||||
|
@ -650,26 +692,89 @@
|
|||
<string>Security</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Show passwords in plain text in:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox_ShowPasswords" >
|
||||
<property name="text" >
|
||||
<string>Edit Entry Dialog</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+O</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox_ShowPasswords_PasswordDlg" >
|
||||
<property name="text" >
|
||||
<string>Key Dialogs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabel1" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>5</vsizetype>
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -682,9 +787,7 @@
|
|||
<item>
|
||||
<widget class="QSpinBox" name="SpinBox_ClipboardTime" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -712,46 +815,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title" >
|
||||
<string>Show passwords in plain text in:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox_ShowPasswords" >
|
||||
<property name="text" >
|
||||
<string>Edit Entry Dialog</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+O</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox_ShowPasswords_PasswordDlg" >
|
||||
<property name="text" >
|
||||
<string>Key Dialogs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
|
@ -767,23 +830,67 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="Seite" >
|
||||
<attribute name="title" >
|
||||
<string>Features</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<string>You can disable several features of KeePassX here according to your needs in order to keep the user interface slim.</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_EnableBookmarkMenu" >
|
||||
<property name="text" >
|
||||
<string>Bookmarks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>131</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2" >
|
||||
<attribute name="title" >
|
||||
<string>Desktop Integration</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="Label_IntPlugin_Error" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>4</vsizetype>
|
||||
<sizepolicy vsizetype="Maximum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -799,9 +906,7 @@
|
|||
<item>
|
||||
<widget class="QGroupBox" name="groupBox" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -810,12 +915,21 @@
|
|||
<string>Plug-Ins</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="Radio_IntPlugin_None" >
|
||||
<property name="text" >
|
||||
|
@ -842,12 +956,21 @@
|
|||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="Label_IntPlugin_Info" >
|
||||
<property name="text" >
|
||||
|
@ -897,18 +1020,125 @@
|
|||
<string>Advanced</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3" >
|
||||
<property name="title" >
|
||||
<string>Auto-Type Fine Tuning</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="spinBox_PreGap" >
|
||||
<property name="whatsThis" >
|
||||
<string>Time between the activation of an auto-type action by the user and the first simulated key stroke.</string>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Pre-Gap:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Key Stroke Delay:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="spinBox_KeyStrokeDelay" >
|
||||
<property name="whatsThis" >
|
||||
<string>Delay between two simulated key strokes. Increase this if Auto-Type is randomly skipping characters.</string>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="verticalSpacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="2" >
|
||||
|
@ -979,9 +1209,7 @@
|
|||
<item row="0" column="2" colspan="2" >
|
||||
<widget class="QCheckBox" name="CheckBox_BrowserDefault" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>4</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -993,80 +1221,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3" >
|
||||
<property name="title" >
|
||||
<string>Auto-Type Fine Tuning</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QSpinBox" name="spinBox_PreGap" >
|
||||
<property name="whatsThis" >
|
||||
<string>Time between the activation of an auto-type action by the user and the first simulated key stroke.</string>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="text" >
|
||||
<string>Pre-Gap:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<string>Key Stroke Delay:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QSpinBox" name="spinBox_KeyStrokeDelay" >
|
||||
<property name="whatsThis" >
|
||||
<string>Delay between two simulated key strokes. Increase this if Auto-Type is randomly skipping characters.</string>
|
||||
</property>
|
||||
<property name="suffix" >
|
||||
<string>ms</string>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="CheckBox_SaveRelativePaths" >
|
||||
<property name="whatsThis" >
|
||||
|
|
|
@ -29,46 +29,29 @@
|
|||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QPair>
|
||||
#include <QMessageBox>
|
||||
#include "main.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "EntryView.h"
|
||||
#include "dialogs/EditEntryDlg.h"
|
||||
#include "lib/AutoType.h"
|
||||
|
||||
|
||||
// just for the lessThan funtion
|
||||
QList<EntryViewItem*>* pItems;
|
||||
KeepassEntryView* pEntryView;
|
||||
|
||||
KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
|
||||
AutoResizeColumns=true;
|
||||
AutoResizeColumns=true;
|
||||
header()->setResizeMode(QHeaderView::Interactive);
|
||||
header()->setStretchLastSection(false);
|
||||
header()->setClickable(true);
|
||||
header()->setCascadingSectionResizes(true);
|
||||
ColumnSizes.resize(NUM_COLUMNS);
|
||||
QStringList ColumnSizeConfig=settings->value("Ui/ColumnSizes",QStringList()<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1"<<"1").toStringList();
|
||||
for(int i=0;i<NUM_COLUMNS;i++)
|
||||
ColumnSizes[i]=(float)ColumnSizeConfig[i].toInt();
|
||||
QStringList DefaultColumnConfig=QStringList()<<"1"<<"1"<<"1"<<"1"<<"1"<<"0"<<"0"<<"0"<<"0"<<"0"<<"1";
|
||||
QStringList ColumnConfig=settings->value("Ui/ShowColumns",DefaultColumnConfig).toStringList();
|
||||
Columns.resize(NUM_COLUMNS);
|
||||
if(ColumnConfig.size()<NUM_COLUMNS)ColumnConfig=DefaultColumnConfig;
|
||||
for(int i=0;i<ColumnConfig.size();i++){
|
||||
Columns[i]=(bool)ColumnConfig[i].toInt();
|
||||
}
|
||||
ColumnOrder.resize(NUM_COLUMNS);
|
||||
QStringList ColumnOrderConfig=settings->value("Ui/ColumnOrder",QStringList()<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100"<<"100").toStringList();
|
||||
for(int i=0;i<NUM_COLUMNS;i++){
|
||||
if(i<ColumnOrderConfig.size()){
|
||||
ColumnOrder[i]=ColumnOrderConfig[i].toInt();
|
||||
}
|
||||
else
|
||||
ColumnOrder[i]=100;
|
||||
}
|
||||
|
||||
ColumnSizes=config->columnSizes();
|
||||
Columns=config->columns();
|
||||
ColumnOrder=config->columnOrder();
|
||||
|
||||
updateColumns();
|
||||
|
||||
|
||||
connect(header(),SIGNAL(sectionResized(int,int,int)),this,SLOT(OnColumnResized(int,int,int)));
|
||||
connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(OnItemsChanged()));
|
||||
connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut()));
|
||||
|
@ -76,31 +59,16 @@ KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
|
|||
connect(header(),SIGNAL(sectionMoved(int,int,int)),this,SLOT(OnColumnMoved(int,int,int)));
|
||||
Clipboard=QApplication::clipboard();
|
||||
ContextMenu=new QMenu(this);
|
||||
setAlternatingRowColors(config.AlternatingRowColors);
|
||||
|
||||
setAlternatingRowColors(config->alternatingRowColors());
|
||||
|
||||
pItems=&Items;
|
||||
pEntryView=this;
|
||||
}
|
||||
|
||||
KeepassEntryView::~KeepassEntryView(){
|
||||
QStringList ColumnSizesConfig;
|
||||
for(int i=0;i<ColumnSizes.size();i++){
|
||||
ColumnSizesConfig<<QString::number((int)(ColumnSizes[i]));
|
||||
}
|
||||
settings->setValue("Ui/ColumnSizes",ColumnSizesConfig);
|
||||
QStringList ColumnConfig;
|
||||
for(int i=0;i<Columns.size();i++){
|
||||
if(Columns[i])
|
||||
ColumnConfig<<"1";
|
||||
else
|
||||
ColumnConfig<<"0";
|
||||
}
|
||||
settings->setValue("Ui/ShowColumns",ColumnConfig);
|
||||
QStringList ColumnOrderConfig;
|
||||
for(int i=0;i<NUM_COLUMNS;i++){
|
||||
ColumnOrderConfig << QString::number(ColumnOrder[i]);
|
||||
}
|
||||
settings->setValue("Ui/ColumnOrder",ColumnOrderConfig);
|
||||
config->setColumnSizes(ColumnSizes);
|
||||
config->setColumns(Columns);
|
||||
config->setColumnOrder(ColumnOrder);
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnGroupChanged(IGroupHandle* group){
|
||||
|
@ -110,7 +78,7 @@ void KeepassEntryView::OnGroupChanged(IGroupHandle* group){
|
|||
|
||||
void KeepassEntryView::OnShowSearchResults(){
|
||||
CurrentGroup=NULL;
|
||||
showSearchResults();
|
||||
showSearchResults();
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,7 +87,7 @@ void KeepassEntryView::OnItemsChanged(){
|
|||
case 0: emit selectionChanged(NONE);
|
||||
break;
|
||||
case 1: emit selectionChanged(SINGLE);
|
||||
break;
|
||||
break;
|
||||
default:emit selectionChanged(MULTIPLE);
|
||||
}
|
||||
}
|
||||
|
@ -128,10 +96,10 @@ bool sortSearchResultsLessThan(const IEntryHandle* a, const IEntryHandle* b){
|
|||
int indexA=0;
|
||||
int indexB=0;
|
||||
for(indexA;indexA<pItems->size();indexA++){
|
||||
if((*pItems)[indexA]->EntryHandle==a)break;
|
||||
if((*pItems)[indexA]->EntryHandle==a)break;
|
||||
}
|
||||
for(indexB;indexB<pItems->size();indexB++){
|
||||
if((*pItems)[indexB]->EntryHandle==b)break;
|
||||
if((*pItems)[indexB]->EntryHandle==b)break;
|
||||
}
|
||||
return pEntryView->indexOfTopLevelItem((*pItems)[indexA])<pEntryView->indexOfTopLevelItem((*pItems)[indexB]);
|
||||
}
|
||||
|
@ -145,12 +113,12 @@ void KeepassEntryView::OnHeaderSectionClicked(int index){
|
|||
else{
|
||||
header()->setSortIndicator(index,Qt::AscendingOrder);
|
||||
header()->setSortIndicatorShown(true);
|
||||
sortItems(index,Qt::AscendingOrder);
|
||||
sortItems(index,Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
|
||||
if(ViewMode==Normal){
|
||||
for(int i=0;i<Items.size();i++){
|
||||
Items[i]->EntryHandle->setVisualIndexDirectly(indexOfTopLevelItem(Items[i]));
|
||||
Items[i]->EntryHandle->setVisualIndexDirectly(indexOfTopLevelItem(Items[i]));
|
||||
}
|
||||
}
|
||||
else if(ViewMode==ShowSearchResults){
|
||||
|
@ -158,16 +126,16 @@ void KeepassEntryView::OnHeaderSectionClicked(int index){
|
|||
qSort(SearchResults.begin(),SearchResults.end(),sortSearchResultsLessThan);
|
||||
else
|
||||
qSort(SearchResults.end(),SearchResults.begin(),sortSearchResultsLessThan);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnSaveAttachment(){
|
||||
Q_ASSERT(selectedItems().size()==1);
|
||||
CEditEntryDlg::saveAttachment(((EntryViewItem*)selectedItems()[0])->EntryHandle,this);
|
||||
CEditEntryDlg::saveAttachment(((EntryViewItem*)selectedItems().first())->EntryHandle,this);
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnCloneEntry(){
|
||||
void KeepassEntryView::OnCloneEntry(){
|
||||
QList<QTreeWidgetItem*> entries=selectedItems();
|
||||
for(int i=0; i<entries.size();i++){
|
||||
Items.append(new EntryViewItem(this));
|
||||
|
@ -180,6 +148,17 @@ void KeepassEntryView::OnCloneEntry(){
|
|||
|
||||
void KeepassEntryView::OnDeleteEntry(){
|
||||
QList<QTreeWidgetItem*> entries=selectedItems();
|
||||
|
||||
if(config->askBeforeDelete()){
|
||||
QString text;
|
||||
if(entries.size()==1)
|
||||
text=tr("Are you sure you want delete this entry?");
|
||||
else
|
||||
text=tr("Are you sure you want delete these %1 entries?").arg(entries.size());
|
||||
if(QMessageBox::question(this,tr("Delete?"),text,QMessageBox::Yes | QMessageBox::No,QMessageBox::No)==QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i=0; i<entries.size();i++){
|
||||
db->deleteEntry(((EntryViewItem*)entries[i])->EntryHandle);
|
||||
Items.removeAt(Items.indexOf((EntryViewItem*)entries[i]));
|
||||
|
@ -193,18 +172,18 @@ void KeepassEntryView::OnDeleteEntry(){
|
|||
void KeepassEntryView::updateEntry(EntryViewItem* item){
|
||||
IEntryHandle* entry = item->EntryHandle;
|
||||
int j=0;
|
||||
if(Columns[0]){
|
||||
if(Columns.at(0)){
|
||||
item->setText(j++,entry->title());
|
||||
item->setIcon(0,db->icon(entry->image()));
|
||||
}
|
||||
if(Columns[1]){
|
||||
if(config.ListView_HideUsernames)
|
||||
if (Columns.at(1)){
|
||||
if(config->hideUsernames())
|
||||
item->setText(j++,"******");
|
||||
else
|
||||
item->setText(j++,entry->username());}
|
||||
if(Columns[2]){item->setText(j++,entry->url());}
|
||||
if(Columns[3]){
|
||||
if(config.ListView_HidePasswords)
|
||||
if (Columns.at(2)){item->setText(j++,entry->url());}
|
||||
if (Columns.at(3)){
|
||||
if(config->hidePasswords())
|
||||
item->setText(j++,"******");
|
||||
else{
|
||||
SecString password=entry->password();
|
||||
|
@ -212,21 +191,21 @@ void KeepassEntryView::updateEntry(EntryViewItem* item){
|
|||
item->setText(j++,password.string());
|
||||
}
|
||||
}
|
||||
if(Columns[4]){
|
||||
item->setText(j++,entry->comment().section('\n',0,0));}
|
||||
if(Columns[5]){
|
||||
if (Columns.at(4)){
|
||||
item->setText(j++,entry->comment().section('\n',0,0));}
|
||||
if (Columns.at(5)){
|
||||
item->setText(j++,entry->expire().dateToString(Qt::LocalDate));}
|
||||
if(Columns[6]){
|
||||
if (Columns.at(6)){
|
||||
item->setText(j++,entry->creation().dateToString(Qt::LocalDate));}
|
||||
if(Columns[7]){
|
||||
if (Columns.at(7)){
|
||||
item->setText(j++,entry->lastMod().dateToString(Qt::LocalDate));}
|
||||
if(Columns[8]){
|
||||
if (Columns.at(8)){
|
||||
item->setText(j++,entry->lastAccess().dateToString(Qt::LocalDate));}
|
||||
if(Columns[9]){
|
||||
if (Columns.at(9)){
|
||||
item->setText(j++,entry->binaryDesc());}
|
||||
if(Columns[10] && ViewMode==ShowSearchResults){
|
||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
||||
item->setText(j,entry->group()->title());
|
||||
item->setIcon(j++,db->icon(entry->group()->image()));}
|
||||
item->setIcon(j++,db->icon(entry->group()->image()));}
|
||||
}
|
||||
|
||||
void KeepassEntryView::editEntry(EntryViewItem* item){
|
||||
|
@ -238,13 +217,13 @@ void KeepassEntryView::editEntry(EntryViewItem* item){
|
|||
updateEntry(item);
|
||||
emit fileModified();
|
||||
break;
|
||||
case 2: //entry moved to another group
|
||||
case 2: //entry moved to another group
|
||||
delete item;
|
||||
Items.removeAt(Items.indexOf(item));
|
||||
Items.removeAt(Items.indexOf(item));
|
||||
emit fileModified();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -260,7 +239,7 @@ void KeepassEntryView::OnNewEntry(){
|
|||
updateEntry(Items.back());
|
||||
emit fileModified();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
|
||||
|
@ -274,49 +253,58 @@ void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
|
|||
case 3: OnPasswordToClipboard();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnEditEntry(){
|
||||
Q_ASSERT(selectedItems().size()==1);
|
||||
editEntry((EntryViewItem*)selectedItems()[0]);
|
||||
editEntry((EntryViewItem*)selectedItems().first());
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnEditOpenUrl(){
|
||||
Q_ASSERT(selectedItems().size()==1);
|
||||
openBrowser(((EntryViewItem*)selectedItems()[0])->text(logicalColIndex(2)));
|
||||
openBrowser(((EntryViewItem*)selectedItems().first())->text(logicalColIndex(2)));
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnUsernameToClipboard(){
|
||||
Clipboard->setText(((EntryViewItem*)selectedItems()[0])->EntryHandle->username(), QClipboard::Clipboard);
|
||||
Clipboard->setText(((EntryViewItem*)selectedItems().first())->EntryHandle->username(), QClipboard::Clipboard);
|
||||
if(Clipboard->supportsSelection()){
|
||||
Clipboard->setText(((EntryViewItem*)selectedItems().first())->EntryHandle->username(),QClipboard::Selection);
|
||||
}
|
||||
ClipboardTimer.setSingleShot(true);
|
||||
ClipboardTimer.start(config.ClipboardTimeOut*1000);
|
||||
ClipboardTimer.start(config->clipboardTimeOut()*1000);
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnPasswordToClipboard(){
|
||||
SecString password;
|
||||
password=((EntryViewItem*)selectedItems()[0])->EntryHandle->password();
|
||||
password=((EntryViewItem*)selectedItems().first())->EntryHandle->password();
|
||||
password.unlock();
|
||||
Clipboard->setText(password.string(),QClipboard::Clipboard);
|
||||
if(Clipboard->supportsSelection()){
|
||||
Clipboard->setText(password.string(),QClipboard::Selection);
|
||||
}
|
||||
ClipboardTimer.setSingleShot(true);
|
||||
ClipboardTimer.start(config.ClipboardTimeOut*1000);
|
||||
ClipboardTimer.start(config->clipboardTimeOut()*1000);
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnClipboardTimeOut(){
|
||||
Clipboard->clear(QClipboard::Clipboard);
|
||||
if(Clipboard->supportsSelection()){
|
||||
Clipboard->clear(QClipboard::Selection);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){
|
||||
if(itemAt(e->pos())){
|
||||
EntryViewItem* item=(EntryViewItem*)itemAt(e->pos());
|
||||
if(selectedItems().size()==0){
|
||||
if(!selectedItems().size()){
|
||||
setItemSelected(item,true);
|
||||
}
|
||||
else{
|
||||
if(!isItemSelected(item)){
|
||||
while(selectedItems().size()){
|
||||
setItemSelected(selectedItems()[0],false);
|
||||
setItemSelected(selectedItems().first(),false);
|
||||
}
|
||||
setItemSelected(item,true);
|
||||
}
|
||||
|
@ -324,7 +312,7 @@ void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){
|
|||
}
|
||||
else
|
||||
{while(selectedItems().size()){
|
||||
setItemSelected(selectedItems()[0],false);}
|
||||
setItemSelected(selectedItems().first(),false);}
|
||||
}
|
||||
e->accept();
|
||||
ContextMenu->popup(e->globalPos());
|
||||
|
@ -339,7 +327,7 @@ void KeepassEntryView::resizeEvent(QResizeEvent* e){
|
|||
void KeepassEntryView::showSearchResults(){
|
||||
if(ViewMode==Normal){
|
||||
ViewMode=ShowSearchResults;
|
||||
if(Columns[10])ColumnOrder[10]--;
|
||||
if(Columns.at(10))ColumnOrder[10]--;
|
||||
updateColumns();
|
||||
}
|
||||
clear();
|
||||
|
@ -357,7 +345,7 @@ void KeepassEntryView::showGroup(IGroupHandle* group){
|
|||
Items.clear();
|
||||
if(group==NULL)return;
|
||||
QList<IEntryHandle*>entries=db->entries(group);
|
||||
createItems(entries);
|
||||
createItems(entries);
|
||||
}
|
||||
|
||||
void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
|
||||
|
@ -368,17 +356,17 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
|
|||
Items.push_back(item);
|
||||
Items.back()->EntryHandle=entries[i];
|
||||
int j=0;
|
||||
if(Columns[0]){
|
||||
if (Columns.at(0)){
|
||||
item->setText(j++,entries[i]->title());
|
||||
item->setIcon(0,db->icon(entries[i]->image()));}
|
||||
if(Columns[1]){
|
||||
if(config.ListView_HideUsernames)
|
||||
if (Columns.at(1)){
|
||||
if(config->hideUsernames())
|
||||
item->setText(j++,"******");
|
||||
else
|
||||
item->setText(j++,entries[i]->username());}
|
||||
if(Columns[2]){item->setText(j++,entries[i]->url());}
|
||||
if(Columns[3]){
|
||||
if(config.ListView_HidePasswords)
|
||||
if (Columns.at(2)){item->setText(j++,entries[i]->url());}
|
||||
if (Columns.at(3)){
|
||||
if(config->hidePasswords())
|
||||
item->setText(j++,"******");
|
||||
else{
|
||||
SecString password=entries[i]->password();
|
||||
|
@ -386,19 +374,19 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
|
|||
item->setText(j++,password.string());
|
||||
}
|
||||
}
|
||||
if(Columns[4]){
|
||||
if (Columns.at(4)){
|
||||
item->setText(j++,entries[i]->comment().section('\n',0,0));}
|
||||
if(Columns[5]){
|
||||
if (Columns.at(5)){
|
||||
item->setText(j++,entries[i]->expire().dateToString(Qt::LocalDate));}
|
||||
if(Columns[6]){
|
||||
if (Columns.at(6)){
|
||||
item->setText(j++,entries[i]->creation().dateToString(Qt::LocalDate));}
|
||||
if(Columns[7]){
|
||||
if (Columns.at(7)){
|
||||
item->setText(j++,entries[i]->lastMod().dateToString(Qt::LocalDate));}
|
||||
if(Columns[8]){
|
||||
if (Columns.at(8)){
|
||||
item->setText(j++,entries[i]->lastAccess().dateToString(Qt::LocalDate));}
|
||||
if(Columns[9]){
|
||||
if (Columns.at(9)){
|
||||
item->setText(j++,entries[i]->binaryDesc());}
|
||||
if(Columns[10] && ViewMode==ShowSearchResults){
|
||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
||||
item->setText(j,entries[i]->group()->title());
|
||||
item->setIcon(j++,db->icon(entries[i]->group()->image()));}
|
||||
}
|
||||
|
@ -406,8 +394,8 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
|
|||
|
||||
void KeepassEntryView::updateIcons(){
|
||||
for(int i=0;i<Items.size();i++){
|
||||
Items[i]->setIcon(0,db->icon(Items[i]->EntryHandle->image()));
|
||||
}
|
||||
Items[i]->setIcon(0,db->icon(Items[i]->EntryHandle->image()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -418,44 +406,45 @@ void KeepassEntryView::setEntry(IEntryHandle* entry){
|
|||
void KeepassEntryView::updateColumns(){
|
||||
setColumnCount(0);
|
||||
QStringList cols;
|
||||
if(Columns[0]){
|
||||
cols << tr("Title");}
|
||||
if(Columns[1]){
|
||||
cols << tr("Username");}
|
||||
if(Columns[2]){
|
||||
cols << tr("URL");}
|
||||
if(Columns[3]){
|
||||
cols << tr("Password");}
|
||||
if(Columns[4]){
|
||||
cols << tr("Comments");}
|
||||
if(Columns[5]){
|
||||
cols << tr("Expires");}
|
||||
if(Columns[6]){
|
||||
cols << tr("Creation");}
|
||||
if(Columns[7]){
|
||||
cols << tr("Last Change");}
|
||||
if(Columns[8]){
|
||||
cols << tr("Last Access");}
|
||||
if(Columns[9]){
|
||||
cols << tr("Attachment");}
|
||||
if(Columns[10] && ViewMode==ShowSearchResults){
|
||||
cols << tr("Group");}
|
||||
if (Columns.at(0)){
|
||||
cols << tr("Title");}
|
||||
if (Columns.at(1)){
|
||||
cols << tr("Username");}
|
||||
if (Columns.at(2)){
|
||||
cols << tr("URL");}
|
||||
if (Columns.at(3)){
|
||||
cols << tr("Password");}
|
||||
if (Columns.at(4)){
|
||||
cols << tr("Comments");}
|
||||
if (Columns.at(5)){
|
||||
cols << tr("Expires");}
|
||||
if (Columns.at(6)){
|
||||
cols << tr("Creation");}
|
||||
if (Columns.at(7)){
|
||||
cols << tr("Last Change");}
|
||||
if (Columns.at(8)){
|
||||
cols << tr("Last Access");}
|
||||
if (Columns.at(9)){
|
||||
cols << tr("Attachment");}
|
||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
||||
cols << tr("Group");}
|
||||
setHeaderLabels(cols);
|
||||
|
||||
|
||||
for(int i=0;i<NUM_COLUMNS;i++){
|
||||
if(!Columns[i])ColumnOrder[i]=100;
|
||||
if(!Columns.at(i))
|
||||
ColumnOrder[i]=100;
|
||||
}
|
||||
|
||||
|
||||
QMap<int,int> Order;
|
||||
for(int i=NUM_COLUMNS-1;i>=0;i--)
|
||||
Order.insertMulti(ColumnOrder[i],i);
|
||||
|
||||
Order.insertMulti(ColumnOrder.at(i),i);
|
||||
|
||||
QMapIterator<int, int> i(Order);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
int index=i.value();
|
||||
if(!Columns[index])continue;
|
||||
header()->moveSection(header()->visualIndex(logicalColIndex(index)),header()->count()-1);
|
||||
if(!Columns.at(index))continue;
|
||||
header()->moveSection(header()->visualIndex(logicalColIndex(index)),header()->count()-1);
|
||||
}
|
||||
|
||||
resizeColumns();
|
||||
|
@ -469,61 +458,63 @@ void KeepassEntryView::refreshItems(){
|
|||
void KeepassEntryView::OnColumnMoved(int LogIndex,int OldVisIndex,int NewVisIndex){
|
||||
for(int i=0;i<header()->count();i++){
|
||||
ColumnOrder[columnListIndex(header()->logicalIndex(i))]=i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int KeepassEntryView::logicalColIndex(int LstIndex){
|
||||
qDebug("%i",LstIndex);
|
||||
int c=-1;
|
||||
for(int i=0;i<NUM_COLUMNS;i++){
|
||||
if(Columns[i])c++;
|
||||
if(i==10 && Columns[10] && ViewMode!=ShowSearchResults)c--;
|
||||
if(i==LstIndex)return c;
|
||||
if(Columns.at(i))c++;
|
||||
if(i==10 && Columns.at(10) && ViewMode!=ShowSearchResults)c--;
|
||||
if(i==LstIndex)return c;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
void KeepassEntryView::resizeColumns(){
|
||||
void KeepassEntryView::resizeColumns(){
|
||||
AutoResizeColumns=false;
|
||||
int w=viewport()->width();
|
||||
int sum=0;
|
||||
|
||||
|
||||
for(int i=0;i<NUM_COLUMNS;i++){
|
||||
// if(i==10) continue; //skip "Group" column
|
||||
if(!Columns[i])ColumnSizes[i]=0;
|
||||
if(Columns[i] && ColumnSizes[i]==0)ColumnSizes[i]=0.1f*(float)w;
|
||||
if(!Columns.at(i))
|
||||
ColumnSizes[i]=0;
|
||||
if(Columns.at(i) && !ColumnSizes.at(i))
|
||||
ColumnSizes[i]=w/10;
|
||||
}
|
||||
|
||||
for(int i=0;i<header()->count();i++){
|
||||
sum+=ColumnSizes[columnListIndex(i)];
|
||||
sum+=ColumnSizes.at(columnListIndex(i));
|
||||
}
|
||||
float stretch=((float)w)/((float)sum);
|
||||
sum=0;
|
||||
for(int i=0;i<header()->count();i++){
|
||||
int lstIndex=columnListIndex(header()->logicalIndex(i));
|
||||
int NewSize=qRound(stretch*(float)ColumnSizes[lstIndex]);
|
||||
int NewSize=qRound(stretch*(float)ColumnSizes.at(lstIndex));
|
||||
sum+=NewSize;
|
||||
if(i==header()->count()-1){
|
||||
NewSize+=(w-sum); // add rounding difference to the last column
|
||||
}
|
||||
header()->resizeSection(header()->logicalIndex(i),NewSize);
|
||||
ColumnSizes[lstIndex]=NewSize;
|
||||
}
|
||||
}
|
||||
AutoResizeColumns=true;
|
||||
}
|
||||
|
||||
int KeepassEntryView::columnListIndex(int LogicalIndex){
|
||||
int c=-1; int i=0;
|
||||
for(i;i<NUM_COLUMNS;i++){
|
||||
if(Columns[i])c++;
|
||||
if(i==10 && Columns[10] && ViewMode!=ShowSearchResults)c--;
|
||||
if(Columns.at(i))c++;
|
||||
if(i==10 && Columns.at(10) && ViewMode!=ShowSearchResults)c--;
|
||||
if(c==LogicalIndex)break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
void KeepassEntryView::OnColumnResized(int lindex,int Old, int New){
|
||||
void KeepassEntryView::OnColumnResized(int lindex,int Old, int New){
|
||||
if(!AutoResizeColumns)return;
|
||||
for(int i=0;i<header()->count();i++){
|
||||
ColumnSizes[columnListIndex(i)]=header()->sectionSize(i);
|
||||
|
@ -534,7 +525,7 @@ void KeepassEntryView::OnColumnResized(int lindex,int Old, int New){
|
|||
void KeepassEntryView::mousePressEvent(QMouseEvent *event){
|
||||
//save event position - maybe this is the start of a drag
|
||||
if (event->button() == Qt::LeftButton)
|
||||
DragStartPos = event->pos();
|
||||
DragStartPos = event->pos();
|
||||
QTreeWidget::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
@ -543,15 +534,15 @@ void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
|
|||
return;
|
||||
if ((event->pos() - DragStartPos).manhattanLength() < QApplication::startDragDistance())
|
||||
return;
|
||||
|
||||
|
||||
DragItems.clear();
|
||||
EntryViewItem* DragStartItem=(EntryViewItem*)itemAt(DragStartPos);
|
||||
if(!DragStartItem){
|
||||
while(selectedItems().size()){
|
||||
setItemSelected(selectedItems()[0],false);}
|
||||
setItemSelected(selectedItems().first(),false);}
|
||||
return;
|
||||
}
|
||||
if(selectedItems().size()==0){
|
||||
if(selectedItems().isEmpty()){
|
||||
setItemSelected(DragStartItem,true);}
|
||||
else{
|
||||
bool AlreadySelected=false;
|
||||
|
@ -560,17 +551,17 @@ void KeepassEntryView::mouseMoveEvent(QMouseEvent *event){
|
|||
}
|
||||
if(!AlreadySelected){
|
||||
while(selectedItems().size()){
|
||||
setItemSelected(selectedItems()[0],false);
|
||||
setItemSelected(selectedItems().first(),false);
|
||||
}
|
||||
setItemSelected(DragStartItem,true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DragItems=selectedItems();
|
||||
QDrag *drag = new QDrag(this);
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
void* pDragItems=&DragItems;
|
||||
mimeData->setData("text/plain;charset=UTF-8",DragItems[0]->text(0).toUtf8());
|
||||
mimeData->setData("text/plain;charset=UTF-8",DragItems.first()->text(0).toUtf8());
|
||||
mimeData->setData("application/x-keepassx-entry",QByteArray((char*)&pDragItems,sizeof(void*)));
|
||||
drag->setMimeData(mimeData);
|
||||
drag->setPixmap(DragPixmap);
|
||||
|
@ -584,16 +575,16 @@ void KeepassEntryView::removeDragItems(){
|
|||
if(Items[j]==DragItems[i]){
|
||||
Items.removeAt(j);
|
||||
j--;
|
||||
delete DragItems[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
delete DragItems[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void KeepassEntryView::OnAutoType(){
|
||||
Q_ASSERT(selectedItems().size()==1);
|
||||
QString error;
|
||||
AutoType::perform(((EntryViewItem*)selectedItems()[0])->EntryHandle,error);
|
||||
AutoType::perform(((EntryViewItem*)selectedItems().first())->EntryHandle,error);
|
||||
}
|
||||
|
||||
void KeepassEntryView::paintEvent(QPaintEvent * event){
|
||||
|
@ -624,13 +615,13 @@ bool EntryViewItem::operator<(const QTreeWidgetItem& other)const{
|
|||
if(ListIndex < 5 || ListIndex==9 || ListIndex==10){ //columns with string values (Title, Username, Password, URL, Comment, Group)
|
||||
if(QString::localeAwareCompare(text(SortCol),other.text(SortCol)) < 0)
|
||||
return true;
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
KpxDateTime DateThis;
|
||||
KpxDateTime DateOther;
|
||||
|
||||
|
||||
|
||||
switch(SortCol){
|
||||
case 5: DateThis=EntryHandle->expire();
|
||||
DateOther=((EntryViewItem&)other).EntryHandle->expire();
|
||||
|
@ -654,7 +645,7 @@ void KeepassEntryView::setCurrentEntry(IEntryHandle* entry){
|
|||
bool found=false;
|
||||
int i=0;
|
||||
for(i;i<Items.size();i++)
|
||||
if(Items[i]->EntryHandle==entry){found=true; break;}
|
||||
if(Items.at(i)->EntryHandle==entry){found=true; break;}
|
||||
if(!found)return;
|
||||
setCurrentItem(Items[i]);
|
||||
setCurrentItem(Items.at(i));
|
||||
}
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
#include <QHeaderView>
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QVarLengthArray>
|
||||
#include "../StandardDatabase.h"
|
||||
#include <QBitArray>
|
||||
#include <QList>
|
||||
#include "../Kdb3Database.h"
|
||||
|
||||
#define NUM_COLUMNS 11
|
||||
|
||||
|
@ -49,17 +50,17 @@ class KeepassEntryView:public QTreeWidget{
|
|||
QList<EntryViewItem*>Items;
|
||||
QList<IEntryHandle*> SearchResults;
|
||||
QMenu *ContextMenu;
|
||||
QVarLengthArray<bool>Columns;
|
||||
void setCurrentEntry(IEntryHandle* entry);
|
||||
QBitArray Columns;
|
||||
void setCurrentEntry(IEntryHandle* entry);
|
||||
private:
|
||||
void setEntry(IEntryHandle* entry);
|
||||
void updateEntry(EntryViewItem*);
|
||||
void editEntry(EntryViewItem*);
|
||||
void createItems(QList<IEntryHandle*>& entries);
|
||||
int logicalColIndex(int ListIndex);
|
||||
|
||||
|
||||
QClipboard* Clipboard;
|
||||
QTimer ClipboardTimer;
|
||||
QTimer ClipboardTimer;
|
||||
void resizeColumns();
|
||||
bool AutoResizeColumns;
|
||||
QPoint DragStartPos;
|
||||
|
@ -68,10 +69,10 @@ class KeepassEntryView:public QTreeWidget{
|
|||
IGroupHandle* CurrentGroup;
|
||||
enum EntryViewMode {Normal, ShowSearchResults};
|
||||
EntryViewMode ViewMode;
|
||||
QVarLengthArray<float>ColumnSizes;
|
||||
QVarLengthArray<int>ColumnOrder;
|
||||
QList<int> ColumnSizes;
|
||||
QList<int> ColumnOrder;
|
||||
float GroupColumnSize;
|
||||
|
||||
|
||||
virtual void contextMenuEvent(QContextMenuEvent *event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
***************************************************************************/
|
||||
|
||||
#include <QDir>
|
||||
#include <QSettings>
|
||||
#include "main.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "FileDialogs.h"
|
||||
|
||||
|
||||
|
@ -29,55 +29,65 @@ QtStandardFileDialogs DefaultQtDlgs;
|
|||
FileDlgHistory fileDlgHistory;
|
||||
|
||||
void KpxFileDialogs::setPlugin(IFileDialog* plugin){
|
||||
iFileDialog=plugin;
|
||||
iFileDialog=plugin;
|
||||
}
|
||||
|
||||
QString KpxFileDialogs::openExistingFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,const QString& Dir)
|
||||
QString KpxFileDialogs::openExistingFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,QString Dir,int SelectedFilter)
|
||||
{
|
||||
QString dir;
|
||||
if(iFileDialog==NULL)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
|
||||
if(Dir==QString()) dir=fileDlgHistory.getDir(Name);
|
||||
else dir=Dir;
|
||||
QString result = iFileDialog->openExistingFileDialog(Parent,Title,dir,Filters);
|
||||
if(result!=QString()){
|
||||
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
|
||||
if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
|
||||
if(Dir==QString())
|
||||
Dir=fileDlgHistory.getDir(Name);
|
||||
if(SelectedFilter==-1)
|
||||
SelectedFilter=fileDlgHistory.getFilter(Name);
|
||||
QString result = iFileDialog->openExistingFileDialog(Parent,Title,Dir,Filters,SelectedFilter);
|
||||
if(!result.isEmpty()){
|
||||
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList KpxFileDialogs::openExistingFiles(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,const QString& Dir)
|
||||
QStringList KpxFileDialogs::openExistingFiles(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,QString Dir,int SelectedFilter)
|
||||
{
|
||||
if(iFileDialog==NULL)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
|
||||
//Load History here!
|
||||
QStringList results=iFileDialog->openExistingFilesDialog(Parent,Title,QString(),Filters);
|
||||
if(results.size()){
|
||||
fileDlgHistory.set(Name,results[0].left(results[0].lastIndexOf("/")+1),iFileDialog->getLastFilter());
|
||||
if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
|
||||
if(Dir==QString())
|
||||
Dir=fileDlgHistory.getDir(Name);
|
||||
if(SelectedFilter==-1)
|
||||
SelectedFilter=fileDlgHistory.getFilter(Name);
|
||||
QStringList results=iFileDialog->openExistingFilesDialog(Parent,Title,QString(),Filters,SelectedFilter);
|
||||
if(!results.isEmpty()){
|
||||
fileDlgHistory.set(Name,results[0].left(results[0].lastIndexOf("/")+1),iFileDialog->getLastFilter());
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,bool OverWriteWarn, const QString& Dir)
|
||||
QString KpxFileDialogs::saveFile(QWidget* Parent, const QString& Name, const QString& Title,const QStringList& Filters,bool OverWriteWarn,QString Dir,int SelectedFilter)
|
||||
{
|
||||
if(iFileDialog==NULL)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
|
||||
//Load History here!
|
||||
QString result = iFileDialog->saveFileDialog(Parent,Title,QString(),Filters,OverWriteWarn);
|
||||
if(result!=QString()){
|
||||
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
|
||||
if(!iFileDialog)iFileDialog=dynamic_cast<IFileDialog*>(&DefaultQtDlgs);
|
||||
if(Dir==QString())
|
||||
Dir=fileDlgHistory.getDir(Name);
|
||||
if(SelectedFilter==-1)
|
||||
SelectedFilter=fileDlgHistory.getFilter(Name);
|
||||
QString result = iFileDialog->saveFileDialog(Parent,Title,QString(),Filters,SelectedFilter,OverWriteWarn);
|
||||
if(!result.isEmpty()){
|
||||
fileDlgHistory.set(Name,result.left(result.lastIndexOf("/")+1),iFileDialog->getLastFilter());
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
QString QtStandardFileDialogs::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters){
|
||||
QString QtStandardFileDialogs::openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter){
|
||||
if(SelectedFilter >= Filters.size())
|
||||
SelectedFilter=0;
|
||||
QFileDialog FileDlg(parent,title,dir);
|
||||
FileDlg.setFilters(Filters);
|
||||
FileDlg.setFileMode(QFileDialog::ExistingFile);
|
||||
FileDlg.selectFilter(Filters[SelectedFilter]);
|
||||
if(!FileDlg.exec())return QString();
|
||||
if(!FileDlg.selectedFiles().size())return QString();
|
||||
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
|
||||
return FileDlg.selectedFiles()[0];
|
||||
return FileDlg.selectedFiles()[0];
|
||||
}
|
||||
|
||||
QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters){
|
||||
QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter){
|
||||
QFileDialog FileDlg(parent,title,dir);
|
||||
FileDlg.setFilters(Filters);
|
||||
FileDlg.setFileMode(QFileDialog::ExistingFiles);
|
||||
|
@ -86,7 +96,7 @@ QStringList QtStandardFileDialogs::openExistingFilesDialog(QWidget* parent,QStri
|
|||
return FileDlg.selectedFiles();
|
||||
}
|
||||
|
||||
QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,bool ShowOverwriteWarning){
|
||||
QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter, bool ShowOverwriteWarning){
|
||||
QFileDialog FileDlg(parent,title,dir);
|
||||
FileDlg.setFilters(Filters);
|
||||
FileDlg.setFileMode(QFileDialog::AnyFile);
|
||||
|
@ -94,11 +104,11 @@ QString QtStandardFileDialogs::saveFileDialog(QWidget* parent,QString title,QStr
|
|||
FileDlg.setConfirmOverwrite(ShowOverwriteWarning);
|
||||
if(!FileDlg.exec())return QString();
|
||||
LastFilter=FileDlg.filters().indexOf(FileDlg.selectedFilter());
|
||||
return FileDlg.selectedFiles()[0];
|
||||
return FileDlg.selectedFiles().first();
|
||||
}
|
||||
|
||||
int QtStandardFileDialogs::getLastFilter(){
|
||||
return LastFilter;
|
||||
return LastFilter;
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,37 +131,40 @@ int FileDlgHistory::getFilter(const QString& name){
|
|||
void FileDlgHistory::set(const QString& name,const QString& dir, int filter){
|
||||
History[name]=Entry();
|
||||
History[name].Dir=dir;
|
||||
History[name].Filter=filter;
|
||||
History[name].Filter=filter;
|
||||
}
|
||||
void FileDlgHistory::save(){
|
||||
if(settings->value("General/SaveFileDlgHistory",QVariant(true)).toBool()){
|
||||
settings->beginGroup("FileDlgHistory");
|
||||
for(int i=0;i<History.size();i++){
|
||||
if(config->saveFileDlgHistory()){
|
||||
//settings->beginGroup("FileDlgHistory");
|
||||
for(unsigned i=0;i<static_cast<unsigned>(History.size());i++){
|
||||
QStringList entry;
|
||||
entry << History.keys()[i]
|
||||
<< History.values()[i].Dir
|
||||
<< QString::number(History.values()[i].Filter);
|
||||
settings->setValue(QString("ENTRY%1").arg(i),QVariant(entry));
|
||||
entry << History.keys().at(i)
|
||||
<< History.values().at(i).Dir
|
||||
<< QString::number(History.values().at(i).Filter);
|
||||
//settings->setValue(QString("ENTRY%1").arg(i),QVariant(entry));
|
||||
config->setFileDlgHistory(i,entry);
|
||||
}
|
||||
settings->endGroup();
|
||||
//settings->endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void FileDlgHistory::load(){
|
||||
if(settings->value("General/SaveFileDlgHistory",QVariant(true)).toBool()){
|
||||
settings->beginGroup("FileDlgHistory");
|
||||
QStringList keys=settings->childKeys();
|
||||
for(int i=0;i<keys.size();i++){
|
||||
if(config->saveFileDlgHistory()){
|
||||
//settings->beginGroup("FileDlgHistory");
|
||||
//QStringList keys=settings->childKeys();
|
||||
unsigned count=config->fileDlgHistorySize();
|
||||
for(unsigned i=0;i</*keys.size()*/count;i++){
|
||||
Entry entry;
|
||||
QStringList value=settings->value(QString("ENTRY%1").arg(i)).toStringList();
|
||||
QStringList value=config->fileDlgHistory(i);//settings->value(QString("ENTRY%1").arg(i)).toStringList();
|
||||
entry.Dir=value[1];
|
||||
entry.Filter=value[2].toInt();
|
||||
History[value[0]]=entry;
|
||||
History[value[0]]=entry;
|
||||
}
|
||||
settings->endGroup();
|
||||
//settings->endGroup();
|
||||
}
|
||||
else{
|
||||
settings->remove("FileDlgHistory");
|
||||
config->clearFileDlgHistory();
|
||||
//settings->remove("FileDlgHistory");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,17 +55,19 @@ class KpxFileDialogs{
|
|||
static QString openExistingFile(QWidget* parent, const QString& Name,
|
||||
const QString& Title,
|
||||
const QStringList& Filters,
|
||||
const QString& Dir=QString());
|
||||
QString Dir=QString(),
|
||||
int SelectedFilter=-1);
|
||||
static QStringList openExistingFiles(QWidget* parent, const QString& Name,
|
||||
const QString& Title,
|
||||
const QStringList& Filters,
|
||||
const QString& Dir=QString());
|
||||
const QString Dir=QString(),
|
||||
int SelectedFilter=-1);
|
||||
static QString saveFile(QWidget* parent, const QString& Name,
|
||||
const QString& Title,
|
||||
const QStringList& Filters,
|
||||
bool ShowOverwriteWarning=true,
|
||||
const QString& Dir=QString()
|
||||
);
|
||||
QString Dir=QString(),
|
||||
int SelectedFilter=-1);
|
||||
private:
|
||||
static IFileDialog* iFileDialog;
|
||||
|
||||
|
@ -77,9 +79,9 @@ class KpxFileDialogs{
|
|||
class QtStandardFileDialogs:public QObject,public IFileDialog{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QString openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters);
|
||||
QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters);
|
||||
QString saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,bool ShowOverwriteWarning);
|
||||
QString openExistingFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
|
||||
QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter);
|
||||
QString saveFileDialog(QWidget* parent,QString title,QString dir,QStringList Filters,int SelectedFilter,bool ShowOverwriteWarning);
|
||||
int getLastFilter();
|
||||
private:
|
||||
int LastFilter;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <QPen>
|
||||
#include <QBrush>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include "KpxConfig.h"
|
||||
#include "main.h"
|
||||
#include "EntryView.h"
|
||||
#include "GroupView.h"
|
||||
|
@ -99,6 +101,12 @@ void KeepassGroupView::addChilds(GroupViewItem* item){
|
|||
}
|
||||
|
||||
void KeepassGroupView::OnDeleteGroup(){
|
||||
if(config->askBeforeDelete()){
|
||||
if(QMessageBox::question(this,tr("Delete?"),
|
||||
tr("Are you sure you want to delete this group, all it's child groups and all their entries?"),
|
||||
QMessageBox::Yes | QMessageBox::No,QMessageBox::No) == QMessageBox::No)
|
||||
return;
|
||||
}
|
||||
GroupViewItem* item=(GroupViewItem*)currentItem();
|
||||
if(item){
|
||||
db->deleteGroup(item->GroupHandle);
|
||||
|
@ -204,6 +212,7 @@ void KeepassGroupView::dragEnterEvent ( QDragEnterEvent * event ){
|
|||
void KeepassGroupView::dragLeaveEvent ( QDragLeaveEvent * event ){
|
||||
if(LastHoverItem){
|
||||
LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base));
|
||||
LastHoverItem->setForeground(0,QBrush(QApplication::palette().color(QPalette::Text)));
|
||||
}
|
||||
if(InsLinePos!=-1){
|
||||
int RemoveLine=InsLinePos;
|
||||
|
@ -345,6 +354,15 @@ void KeepassGroupView::entryDragMoveEvent( QDragMoveEvent * event ){
|
|||
event->ignore();
|
||||
return;
|
||||
}
|
||||
if(Item==SearchResultItem){
|
||||
if(LastHoverItem){
|
||||
LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base));
|
||||
LastHoverItem->setForeground(0,QBrush(QApplication::palette().color(QPalette::Text)));
|
||||
LastHoverItem=NULL;
|
||||
}
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
if(LastHoverItem != Item){
|
||||
if(LastHoverItem){
|
||||
LastHoverItem->setBackgroundColor(0,QApplication::palette().color(QPalette::Base));
|
||||
|
@ -354,7 +372,6 @@ void KeepassGroupView::entryDragMoveEvent( QDragMoveEvent * event ){
|
|||
Item->setForeground(0,QBrush(QApplication::palette().color(QPalette::HighlightedText)));
|
||||
LastHoverItem=Item;
|
||||
}
|
||||
|
||||
event->accept();
|
||||
return;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <QTreeWidget>
|
||||
#include <QLine>
|
||||
#include <QContextMenuEvent>
|
||||
#include "../StandardDatabase.h"
|
||||
#include "../Kdb3Database.h"
|
||||
|
||||
class GroupViewItem;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <math.h>
|
||||
#include <QPainter>
|
||||
#include <QRectF>
|
||||
#include "PwmConfig.h"
|
||||
#include "main.h"
|
||||
#include "WaitAnimationWidget.h"
|
||||
|
||||
|
@ -36,17 +35,17 @@ WaitAnimationWidget::WaitAnimationWidget(QWidget* parent):QWidget(parent){
|
|||
diff=1.0f-diff;
|
||||
if(diff<-0.5f)
|
||||
diff=1.0f+diff;
|
||||
CircSizes[i]=1.0+exp(-14.0f*diff*diff);
|
||||
CircSizes[i]=1.0+exp(-14.0f*diff*diff);
|
||||
}
|
||||
connect(&timer,SIGNAL(timeout()),this,SLOT(refreshAnimation()));
|
||||
connect(&timer,SIGNAL(timeout()),this,SLOT(refreshAnimation()));
|
||||
}
|
||||
|
||||
WaitAnimationWidget::~WaitAnimationWidget(){
|
||||
timer.stop();
|
||||
timer.stop();
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::start(){
|
||||
timer.start();
|
||||
timer.start();
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::stop(){
|
||||
|
@ -68,22 +67,22 @@ void WaitAnimationWidget::refreshAnimation(){
|
|||
diff=1.0f-diff;
|
||||
if(diff<-0.5f)
|
||||
diff=1.0f+diff;
|
||||
CircSizes[i]=1.0+exp(-14.0f*diff*diff);
|
||||
CircSizes[i]=1.0+exp(-14.0f*diff*diff);
|
||||
}
|
||||
repaint();
|
||||
repaint();
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::paintEvent(QPaintEvent* event){
|
||||
if(timer.isActive()){
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::Antialiasing,true);
|
||||
painter.setBrush(Qt::black);
|
||||
painter.setBrush(Qt::black);
|
||||
painter.setPen(Qt::black);
|
||||
for(int i=0;i<6;i++){
|
||||
float d=CircSizes[i]*5.0;
|
||||
QRectF rect(CircPositions[i].x()-d/2,CircPositions[i].y()-d/2,d,d);
|
||||
painter.drawEllipse(rect);
|
||||
}
|
||||
painter.drawEllipse(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +94,7 @@ void WaitAnimationWidget::resizeEvent(QResizeEvent* event){
|
|||
r=width()/2;
|
||||
for(int i=0;i<6;i++){
|
||||
CircPositions[i].setX((r-10)*cos(-2.0*3.14159265*(0.16666667*i))+r);
|
||||
CircPositions[i].setY((r-10)*sin(-2.0*3.14159265*(0.16666667*i))+r);
|
||||
CircPositions[i].setY((r-10)*sin(-2.0*3.14159265*(0.16666667*i))+r);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
164
src/main.cpp
164
src/main.cpp
|
@ -41,8 +41,8 @@
|
|||
|
||||
#include "main.h"
|
||||
#include "lib/FileDialogs.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "StandardDatabase.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "Kdb3Database.h"
|
||||
#include "mainwindow.h"
|
||||
#include "crypto/yarrow.h"
|
||||
using namespace std;
|
||||
|
@ -50,19 +50,18 @@ using namespace std;
|
|||
#ifdef Q_WS_X11
|
||||
#include <X11/extensions/XTest.h>
|
||||
#define XK_LATIN1
|
||||
#define XK_MISCELLANY
|
||||
#define XK_MISCELLANY
|
||||
#define XK_XKB_KEYS
|
||||
#include <X11/keysymdef.h>
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define CSTR(x)(x.toUtf8().data())
|
||||
|
||||
|
||||
QHash<QString,QPixmap*>PixmapCache;
|
||||
QHash<QString,QIcon*>IconCache;
|
||||
|
||||
CConfig config;
|
||||
QSettings* settings;
|
||||
|
||||
KpxConfig *config;
|
||||
QString AppDir;
|
||||
QString PluginLoadError;
|
||||
bool TrActive;
|
||||
|
@ -74,38 +73,58 @@ inline void loadImages();
|
|||
inline void parseCmdLineArgs(int argc, char** argv,QString &ArgFile,QString& ArgCfg,QString& ArgLang);
|
||||
bool loadTranslation(QTranslator* tr,const QString& prefix,const QString& LocaleCode,const QStringList& SearchPaths);
|
||||
|
||||
void test_getAllWindowTitles(){
|
||||
#ifdef Q_WS_X11
|
||||
Display* pDisplay = XOpenDisplay( NULL );
|
||||
Window r,p;
|
||||
Window* c;
|
||||
unsigned int num_ch=0;
|
||||
XQueryTree(pDisplay,DefaultRootWindow(pDisplay),&r,&p,&c,&num_ch);
|
||||
qDebug("%u",num_ch);
|
||||
for(int i=0;i<num_ch;i++){
|
||||
int num_prop=0;
|
||||
Atom* atom=XListProperties(pDisplay,c[i],&num_prop);
|
||||
for(int p=0;p<num_prop;p++){
|
||||
qDebug("%i %i: %s",i,p,XGetAtomName(pDisplay,atom[p]));
|
||||
}
|
||||
XFree(atom);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//test_getAllWindowTitles();
|
||||
//exit(0);
|
||||
QString ArgFile,ArgCfg,ArgLang,IniFilename;
|
||||
QApplication* app=NULL;
|
||||
AppDir=QString(argv[0]);
|
||||
AppDir.truncate(AppDir.lastIndexOf("/"));
|
||||
|
||||
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg,ArgLang);
|
||||
|
||||
//Load Config
|
||||
if(ArgCfg==QString()){
|
||||
if(!QDir(QDir::homePath()+"/.keepass").exists()){
|
||||
QDir conf(QDir::homePath());
|
||||
if(!conf.mkdir(".keepass")){
|
||||
cout << "Warning: Could not create directory '~/.keepass'." << endl;}
|
||||
if(ArgCfg.isEmpty()){
|
||||
if(!QDir(QDir::homePath()+"/.keepassx").exists()){
|
||||
QDir conf(QDir::homePath());
|
||||
if(!conf.mkdir(".keepassx")){
|
||||
cout << "Warning: Could not create directory '~/.keepassx'." << endl;}
|
||||
}
|
||||
IniFilename=QDir::homePath()+"/.keepassx/config";
|
||||
}
|
||||
IniFilename=QDir::homePath()+"/.keepass/config";
|
||||
config.loadFromIni(IniFilename);
|
||||
}
|
||||
else{
|
||||
IniFilename=ArgCfg;
|
||||
config.loadFromIni(IniFilename);}
|
||||
|
||||
|
||||
settings = new QSettings(QDir::homePath()+"/.keepassx/config",QSettings::IniFormat);
|
||||
else
|
||||
IniFilename=ArgCfg;
|
||||
|
||||
|
||||
config = new KpxConfig(IniFilename);
|
||||
fileDlgHistory.load();
|
||||
|
||||
|
||||
//Plugins
|
||||
if(config.IntegrPlugin!=CConfig::NONE){
|
||||
if(config->integrPlugin()!=KpxConfig::NoIntegr){
|
||||
QString LibName="libkeepassx-";
|
||||
if(config.IntegrPlugin==CConfig::KDE)
|
||||
if(config->integrPlugin()==KpxConfig::KDE)
|
||||
LibName+="kde.so";
|
||||
else if(config.IntegrPlugin==CConfig::GNOME)
|
||||
else if(config->integrPlugin()==KpxConfig::Gnome)
|
||||
LibName+="gnome.so";
|
||||
QString filename=findPlugin(LibName);
|
||||
if(filename!=QString()){
|
||||
|
@ -118,44 +137,43 @@ int main(int argc, char **argv)
|
|||
else{
|
||||
IFileDialog* fdlg=qobject_cast<IFileDialog*>(plugin.instance());
|
||||
KpxFileDialogs::setPlugin(fdlg);
|
||||
if(config.IntegrPlugin==CConfig::KDE){
|
||||
if(config->integrPlugin()==KpxConfig::KDE){
|
||||
IKdeInit* kdeinit=qobject_cast<IKdeInit*>(plugin.instance());
|
||||
app=kdeinit->getMainAppObject(argc,argv);
|
||||
if(!app)PluginLoadError=QObject::tr("Initialization failed.");
|
||||
}
|
||||
if(config.IntegrPlugin==CConfig::GNOME){
|
||||
if(config->integrPlugin()==KpxConfig::Gnome){
|
||||
IGnomeInit* ginit=qobject_cast<IGnomeInit*>(plugin.instance());
|
||||
if(!ginit->init(argc,argv)){
|
||||
KpxFileDialogs::setPlugin(NULL);
|
||||
qWarning("GtkIntegrPlugin: Gtk init failed.");
|
||||
PluginLoadError=QObject::tr("Initialization failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
qWarning(CSTR(QString("Could not load desktop integration plugin: File '%1' not found.").arg(LibName)));
|
||||
PluginLoadError=QObject::tr("Could not locate library file.");
|
||||
PluginLoadError=QObject::tr("Could not locate library file.");
|
||||
}
|
||||
}
|
||||
if(!app) QApplication* app=new QApplication(argc,argv);
|
||||
parseCmdLineArgs(argc,argv,ArgFile,ArgCfg,ArgLang);
|
||||
|
||||
|
||||
|
||||
//Internationalization
|
||||
QLocale loc;
|
||||
if(!ArgLang.size())
|
||||
loc=QLocale::system();
|
||||
else
|
||||
loc=QLocale(ArgLang);
|
||||
|
||||
|
||||
QTranslator* translator = NULL;
|
||||
QTranslator* qtTranslator=NULL;
|
||||
translator=new QTranslator;
|
||||
qtTranslator=new QTranslator;
|
||||
|
||||
|
||||
if(loadTranslation(translator,"keepass-",loc.name(),QStringList()
|
||||
<< app->applicationDirPath()+"/../share/keepass/i18n/"
|
||||
<< app->applicationDirPath()+"/../share/keepass/i18n/"
|
||||
<< QDir::homePath()+"/.keepassx/" ))
|
||||
{app->installTranslator(translator);
|
||||
TrActive=true;}
|
||||
|
@ -167,10 +185,10 @@ int main(int argc, char **argv)
|
|||
delete translator;
|
||||
TrActive=false;
|
||||
}
|
||||
|
||||
|
||||
if(loadTranslation(qtTranslator,"qt_",loc.name(),QStringList()
|
||||
<< QLibraryInfo::location(QLibraryInfo::TranslationsPath)
|
||||
<< app->applicationDirPath()+"/../share/keepass/i18n/"
|
||||
<< app->applicationDirPath()+"/../share/keepass/i18n/"
|
||||
<< QDir::homePath()+"/.keepass/" ))
|
||||
app->installTranslator(qtTranslator);
|
||||
else{
|
||||
|
@ -180,19 +198,19 @@ int main(int argc, char **argv)
|
|||
.arg(QLocale::countryToString(loc.country())).toAscii());
|
||||
delete qtTranslator;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QFile templ(QDir::homePath()+"/.keepassx/detailview-template.html"); ///FIXME ArgCfg
|
||||
if(templ.open(QIODevice::ReadOnly)){
|
||||
DetailViewTemplate=QString::fromUtf8(templ.readAll());
|
||||
templ.close();
|
||||
DetailViewTemplate=QString::fromUtf8(templ.readAll());
|
||||
templ.close();
|
||||
}
|
||||
else loadDefaultDetailViewTemplate();
|
||||
|
||||
|
||||
loadImages();
|
||||
initYarrow(); //init random number generator
|
||||
SecString::generateSessionKey();
|
||||
|
||||
|
||||
int r=0;
|
||||
KeepassMainWindow *mainWin = new KeepassMainWindow(ArgFile);
|
||||
if(mainWin->Start){
|
||||
|
@ -200,23 +218,19 @@ int main(int argc, char **argv)
|
|||
r=app->exec();
|
||||
}
|
||||
delete mainWin;
|
||||
if(!config.saveToIni(IniFilename))
|
||||
QMessageBox::warning(NULL,QObject::tr("Warning"),
|
||||
QObject::tr("Could not save configuration file.\nMake sure you have write access to '~/.keepass'."),
|
||||
QObject::tr("OK"),"","",0.0);
|
||||
|
||||
|
||||
if(templ.open(QIODevice::WriteOnly)){
|
||||
templ.write(DetailViewTemplate.toUtf8());
|
||||
templ.close();
|
||||
templ.close();
|
||||
}
|
||||
else{
|
||||
qWarning("Failed to save detail view template: %s",decodeFileError(templ.error()).toUtf8().data());
|
||||
qWarning("Failed to save detail view template: %s",decodeFileError(templ.error()).toUtf8().data());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fileDlgHistory.save();
|
||||
delete app;
|
||||
delete settings;
|
||||
delete config;
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -224,7 +238,7 @@ int main(int argc, char **argv)
|
|||
void loadDefaultDetailViewTemplate(){
|
||||
QFile templ(":/default-detailview.html");
|
||||
templ.open(QIODevice::ReadOnly);
|
||||
DetailViewTemplate=QString::fromUtf8(templ.readAll());
|
||||
DetailViewTemplate=QString::fromUtf8(templ.readAll());
|
||||
templ.close();
|
||||
DetailViewTemplate.replace("Group",QCoreApplication::translate("DetailViewTemplate","Group"));
|
||||
DetailViewTemplate.replace("Title",QCoreApplication::translate("DetailViewTemplate","Title"));
|
||||
|
@ -235,7 +249,7 @@ void loadDefaultDetailViewTemplate(){
|
|||
DetailViewTemplate.replace("Last Access",QCoreApplication::translate("DetailViewTemplate","Last Access"));
|
||||
DetailViewTemplate.replace("Last Modification",QCoreApplication::translate("DetailViewTemplate","Last Modification"));
|
||||
DetailViewTemplate.replace("Expiration",QCoreApplication::translate("DetailViewTemplate","Expiration"));
|
||||
DetailViewTemplate.replace("Comment",QCoreApplication::translate("DetailViewTemplate","Comment"));
|
||||
DetailViewTemplate.replace("Comment",QCoreApplication::translate("DetailViewTemplate","Comment"));
|
||||
}
|
||||
|
||||
//obsolete
|
||||
|
@ -243,14 +257,14 @@ void createBanner(QLabel *Banner,const QPixmap* symbol,QString text){
|
|||
QPixmap Pixmap;
|
||||
createBanner(&Pixmap,symbol,text
|
||||
,Banner->width()
|
||||
,config.BannerColor1
|
||||
,config.BannerColor2
|
||||
,config.BannerTextColor);
|
||||
,config->bannerColor1()
|
||||
,config->bannerColor2()
|
||||
,config->bannerTextColor());
|
||||
Banner->setPixmap(Pixmap);
|
||||
}
|
||||
|
||||
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width){
|
||||
createBanner(Pixmap,IconAlpha,Text,Width,config.BannerColor1,config.BannerColor2,config.BannerTextColor);
|
||||
createBanner(Pixmap,IconAlpha,Text,Width,config->bannerColor1(),config->bannerColor2(),config->bannerTextColor());
|
||||
}
|
||||
|
||||
void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,int Width, QColor Color1, QColor Color2, QColor TextColor){
|
||||
|
@ -262,26 +276,26 @@ void createBanner(QPixmap* Pixmap,const QPixmap* IconAlpha,const QString& Text,i
|
|||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(grad);
|
||||
painter.drawRect(0,0,Width,50);
|
||||
|
||||
|
||||
QPixmap Icon(32,32);
|
||||
if(IconAlpha){
|
||||
Icon.fill(TextColor);
|
||||
Icon.setAlphaChannel(*IconAlpha);
|
||||
painter.drawPixmap(10,10,Icon);
|
||||
}
|
||||
|
||||
|
||||
painter.setPen(QPen(TextColor));
|
||||
painter.setFont(QFont(QApplication::font().family(),16));
|
||||
painter.drawText(50,35,Text);
|
||||
painter.drawText(50,35,Text);
|
||||
}
|
||||
|
||||
QString decodeFileError(QFile::FileError Code){
|
||||
switch(Code){
|
||||
switch(Code){
|
||||
case QFile::NoError: return QApplication::translate("FileErrors","No error occurred.");
|
||||
case QFile::ReadError: return QApplication::translate("FileErrors","An error occurred while reading from the file.");
|
||||
case QFile::WriteError: return QApplication::translate("FileErrors","An error occurred while writing to the file.");
|
||||
case QFile::FatalError: return QApplication::translate("FileErrors","A fatal error occurred.");
|
||||
case QFile::ResourceError: return QApplication::translate("FileErrors","An resource error occurred.");
|
||||
case QFile::ResourceError: return QApplication::translate("FileErrors","An resource error occurred.");
|
||||
case QFile::OpenError: return QApplication::translate("FileErrors","The file could not be opened.");
|
||||
case QFile::AbortError: return QApplication::translate("FileErrors","The operation was aborted.");
|
||||
case QFile::TimeOutError: return QApplication::translate("FileErrors","A timeout occurred.");
|
||||
|
@ -291,7 +305,7 @@ QString decodeFileError(QFile::FileError Code){
|
|||
case QFile::PositionError: return QApplication::translate("FileErrors","The position in the file could not be changed.");
|
||||
case QFile::ResizeError: return QApplication::translate("FileErrors","The file could not be resized.");
|
||||
case QFile::PermissionsError: return QApplication::translate("FileErrors","The file could not be accessed.");
|
||||
case QFile::CopyError: return QApplication::translate("FileErrors","The file could not be copied.");
|
||||
case QFile::CopyError: return QApplication::translate("FileErrors","The file could not be copied.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,11 +313,11 @@ void openBrowser(QString UrlString){
|
|||
QUrl url(UrlString);
|
||||
if(url.scheme().isEmpty())
|
||||
url=QUrl("http://"+UrlString);
|
||||
if(settings->value("BrowserCmd","<<default>>").toString() == "<<default>>"){
|
||||
QDesktopServices::openUrl(url);
|
||||
if(config->urlCmd().isEmpty()){
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
else{
|
||||
QStringList args=settings->value("BrowserCmd","<<default>>").toString().arg(url.toString()).split(' ');
|
||||
QStringList args=config->urlCmd().arg(url.toString()).split(' ');
|
||||
QString cmd=args.takeFirst();
|
||||
QProcess::startDetached(cmd,args);
|
||||
}
|
||||
|
@ -338,7 +352,7 @@ const QIcon& getIcon(const QString& name){
|
|||
return *CachedIcon;
|
||||
QFileInfo IconFile(AppDir+"/../share/keepass/icons/"+name+".png");
|
||||
if(!IconFile.isFile() || !IconFile.exists() || !IconFile.isReadable()){
|
||||
//ERROR
|
||||
///TODO 0.2.3 error handling
|
||||
qWarning("%s",CSTR(name));
|
||||
}
|
||||
QIcon* NewIcon=new QIcon(AppDir+"/../share/keepass/icons/"+name+".png");
|
||||
|
@ -352,7 +366,7 @@ const QPixmap* getPixmap(const QString& name){
|
|||
return CachedPixmap;
|
||||
QImage img;
|
||||
if(!img.load(AppDir+"/../share/keepass/icons/"+name+".png")){
|
||||
//ERROR
|
||||
///TODO 0.2.3 error handling
|
||||
qWarning("%s",CSTR(name));
|
||||
}
|
||||
QPixmap* NewPixmap=new QPixmap(QPixmap::fromImage(img));
|
||||
|
@ -421,11 +435,11 @@ QMessageBox::critical(parent,QObject::tr("Error"),msg,QObject::tr("OK"));
|
|||
|
||||
QString findPlugin(const QString& filename){
|
||||
QFileInfo info;
|
||||
|
||||
|
||||
info.setFile(AppDir+"/../lib/keepassx/"+filename);
|
||||
if(info.exists() && info.isFile())
|
||||
return AppDir+"/../lib/keepassx/"+filename;
|
||||
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
@ -436,11 +450,11 @@ QString makePathRelative(const QString& AbsDir,const QString& CurDir){
|
|||
QString rel="./";
|
||||
int common=0;
|
||||
for(common; common < abs.size() && common < cur.size(); common++){
|
||||
if(abs[common]!=cur[common])break;
|
||||
if(abs[common]!=cur[common])break;
|
||||
}
|
||||
for(int i=0;i<cur.size()-common;i++)
|
||||
rel.append("../");
|
||||
for(int i=common;i<abs.size();i++)
|
||||
rel.append(abs[i]+"/");
|
||||
return rel;
|
||||
return rel;
|
||||
}
|
||||
|
|
|
@ -26,13 +26,12 @@
|
|||
#include <QColor>
|
||||
#include <QIcon>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
|
||||
#define KEEPASS_VERSION "0.2.3"
|
||||
#define BUILTIN_ICONS 62
|
||||
|
||||
typedef enum tKeyType {PASSWORD=0,KEYFILE=1,BOTH=2};
|
||||
class CConfig;
|
||||
class KpxConfig;
|
||||
|
||||
void createBanner(QLabel *Banner,const QPixmap* symbol,QString text);
|
||||
void createBanner(QPixmap* Pixmap, const QPixmap* IconAlpha,const QString& Text,int Width);
|
||||
|
@ -47,9 +46,8 @@ QString makePathRelative(const QString& Abs,const QString& Cur);
|
|||
void loadDefaultDetailViewTemplate();
|
||||
extern QString PluginLoadError;
|
||||
|
||||
extern CConfig config;
|
||||
extern QSettings *settings;
|
||||
extern QString AppDir;
|
||||
extern KpxConfig *config;
|
||||
extern QString AppDir;
|
||||
extern bool TrActive;
|
||||
extern QString DetailViewTemplate;
|
||||
extern QPixmap *EntryIcons;
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "KpxFirefox.h"
|
||||
#include "lib/random.h"
|
||||
#include "lib/IniReader.h"
|
||||
#include "lib/AutoType.h"
|
||||
#include "lib/FileDialogs.h"
|
||||
#include "import/Import_PwManager.h"
|
||||
|
@ -59,6 +58,7 @@
|
|||
#include "dialogs/CollectEntropyDlg.h"
|
||||
#include "dialogs/CustomizeDetailViewDlg.h"
|
||||
#include "dialogs/ExpiredEntriesDlg.h"
|
||||
#include "dialogs/TrashCanDlg.h"
|
||||
|
||||
//#include <QtDBus/QtDBus>
|
||||
#include <iostream>
|
||||
|
@ -77,11 +77,13 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
|
|||
Start=true;
|
||||
ShutingDown=false;
|
||||
setupUi(this);
|
||||
#ifdef QT_WS_MAC
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
#endif
|
||||
AutoType::MainWin=this;
|
||||
setGeometry(settings->value("Ui/MainWindowGeometry",QVariant(geometry())).toRect());
|
||||
VSplitter->restoreState(settings->value("Ui/VSplitterPos").toByteArray());
|
||||
HSplitter->restoreState(settings->value("Ui/HSplitterPos").toByteArray());
|
||||
setGeometry(config->mainWindowGeometry(geometry()));
|
||||
VSplitter->restoreState(config->vSplitterPos());
|
||||
HSplitter->restoreState(config->hSplitterPos());
|
||||
SysTray=new QSystemTrayIcon(this);
|
||||
setupToolbar();
|
||||
setupIcons();
|
||||
|
@ -91,34 +93,34 @@ KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,QWidget *parent, Qt:
|
|||
StatusBarSelection=new QLabel(statusBar());
|
||||
statusBar()->addWidget(StatusBarGeneral,15);
|
||||
statusBar()->addWidget(StatusBarSelection,85);
|
||||
statusBar()->setVisible(config.ShowStatusbar);
|
||||
statusBar()->setVisible(config->showStatusbar());
|
||||
setupConnections();
|
||||
|
||||
FileOpen=false;
|
||||
if(ArgFile!=QString())
|
||||
if(!ArgFile.isEmpty())
|
||||
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(ArgFile)),false);
|
||||
else if(settings->value("OpenLastFile",true).toBool() && (settings->value("LastFile","").toString()!=QString())){
|
||||
QFileInfo file(settings->value("LastFile","").toString());
|
||||
else if(config->openLastFile() && !config->lastFile().isEmpty()){
|
||||
QFileInfo file(config->lastFile());
|
||||
if(file.exists())
|
||||
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(settings->value("LastFile","").toString())),true);
|
||||
openDatabase(QDir::cleanPath(QDir::current().absoluteFilePath(config->lastFile())),true);
|
||||
else
|
||||
settings->setValue("LastFile","");
|
||||
config->setLastFile(QString());
|
||||
}
|
||||
|
||||
// DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine
|
||||
|
||||
// DBus Server of Qt 4.2 does not work - 4.3 snapshot seems to work fine
|
||||
/*
|
||||
//dbusServer=new QDBusServer("unix:path=/tmp/KpxBus",this);
|
||||
//qDebug("DBUS: %s",dbusServer->lastError().message().toAscii().data());
|
||||
//QDBusConnection::connectToBus("unix:path=/tmp/KpxBus","MyKpxConnection");
|
||||
//qDebug("DBUS: %s",dbusCon->lastError().message().toAscii().data());
|
||||
|
||||
|
||||
KpxFirefox* fox=new KpxFirefox(NULL);
|
||||
new KpxFirefoxAdaptor(fox);
|
||||
QDBusConnection::sessionBus().registerService("org.keepassx.firefoxservice");
|
||||
QDBusConnection::sessionBus().registerObject("/KpxFirefox",fox);
|
||||
qDebug("DBUS: %s",QDBusConnection::sessionBus().lastError().message().toAscii().data());
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
void KeepassMainWindow::setupConnections(){
|
||||
|
@ -132,7 +134,7 @@ void KeepassMainWindow::setupConnections(){
|
|||
connect(FileExitAction, SIGNAL(triggered()), this, SLOT(OnFileExit()));
|
||||
connect(menuImport,SIGNAL(triggered(QAction*)),this,SLOT(OnImport(QAction*)));
|
||||
connect(menuExport,SIGNAL(triggered(QAction*)),this,SLOT(OnExport(QAction*)));
|
||||
|
||||
|
||||
connect(EditNewGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnNewGroup()));
|
||||
connect(EditEditGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnEditGroup()));
|
||||
connect(EditDeleteGroupAction, SIGNAL(triggered()), GroupView, SLOT(OnDeleteGroup()));
|
||||
|
@ -162,6 +164,7 @@ void KeepassMainWindow::setupConnections(){
|
|||
connect(ExtrasSettingsAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasSettings()));
|
||||
connect(ExtrasPasswordGenAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasPasswordGen()));
|
||||
connect(ExtrasShowExpiredEntriesAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasShowExpiredEntries()));
|
||||
connect(ExtrasTrashCanAction,SIGNAL(triggered(bool)),this,SLOT(OnExtrasTrashCan()));
|
||||
|
||||
connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook()));
|
||||
connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout()));
|
||||
|
@ -177,15 +180,15 @@ void KeepassMainWindow::setupConnections(){
|
|||
connect(GroupView,SIGNAL(searchResultsSelected()),this,SLOT(OnShowSearchResults()));
|
||||
connect(GroupView,SIGNAL(entriesDropped()),EntryView,SLOT(removeDragItems()));
|
||||
connect(HideSearchResultsAction,SIGNAL(triggered()),GroupView,SLOT(OnHideSearchResults()));
|
||||
|
||||
connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));
|
||||
|
||||
connect(SysTray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this,SLOT(OnSysTrayActivated(QSystemTrayIcon::ActivationReason)));
|
||||
connect(DetailView,SIGNAL(anchorClicked(const QUrl&)),this,SLOT(OnDetailViewUrlClicked(const QUrl&)));
|
||||
}
|
||||
|
||||
void KeepassMainWindow::setupToolbar(){
|
||||
toolBar=new QToolBar(this);
|
||||
addToolBar(toolBar);
|
||||
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
|
||||
toolBar->setIconSize(QSize(config->toolbarIconSize(),config->toolbarIconSize()));
|
||||
ViewShowToolbarAction=toolBar->toggleViewAction();
|
||||
toolBar->addAction(FileNewAction);
|
||||
toolBar->addAction(FileOpenAction);
|
||||
|
@ -228,12 +231,13 @@ void KeepassMainWindow::setupIcons(){
|
|||
ExtrasSettingsAction->setIcon(getIcon("appsettings"));
|
||||
ExtrasShowExpiredEntriesAction->setIcon(getIcon("expired"));
|
||||
ExtrasPasswordGenAction->setIcon(getIcon("generator"));
|
||||
ExtrasTrashCanAction->setIcon(getIcon("trashcan"));
|
||||
EditAutoTypeAction->setIcon(getIcon("autotype"));
|
||||
HelpHandbookAction->setIcon(getIcon("manual"));
|
||||
HelpAboutAction->setIcon(getIcon("help"));
|
||||
SysTray->setIcon(getIcon("keepassx_large"));
|
||||
if(config.ShowSysTrayIcon)
|
||||
SysTray->show();
|
||||
if(config->showSysTrayIcon())
|
||||
SysTray->show();
|
||||
}
|
||||
|
||||
void KeepassMainWindow::setupMenus(){
|
||||
|
@ -245,7 +249,7 @@ void KeepassMainWindow::setupMenus(){
|
|||
GroupView->ContextMenu->addSeparator();
|
||||
GroupView->ContextMenu->addAction(EditGroupSearchAction);
|
||||
GroupView->ContextMenuSearchGroup->addAction(HideSearchResultsAction);
|
||||
|
||||
|
||||
EntryView->ContextMenu->addAction(EditPasswordToClipboardAction);
|
||||
EntryView->ContextMenu->addAction(EditUsernameToClipboardAction);
|
||||
EntryView->ContextMenu->addAction(EditOpenUrlAction);
|
||||
|
@ -256,13 +260,13 @@ void KeepassMainWindow::setupMenus(){
|
|||
EntryView->ContextMenu->addAction(EditEditEntryAction);
|
||||
EntryView->ContextMenu->addAction(EditCloneEntryAction);
|
||||
EntryView->ContextMenu->addAction(EditDeleteEntryAction);
|
||||
|
||||
|
||||
ViewShowToolbarAction->setText(tr("Show Toolbar"));
|
||||
ViewMenu->insertAction(ViewShowEntryDetailsAction,ViewShowToolbarAction);
|
||||
ViewShowToolbarAction->setChecked(config.Toolbar);
|
||||
ViewShowEntryDetailsAction->setChecked(config.EntryDetails);
|
||||
ViewHidePasswordsAction->setChecked(config.ListView_HidePasswords);
|
||||
ViewHideUsernamesAction->setChecked(config.ListView_HideUsernames);
|
||||
ViewShowToolbarAction->setChecked(config->showToolbar());
|
||||
ViewShowEntryDetailsAction->setChecked(config->showEntryDetails());
|
||||
ViewHidePasswordsAction->setChecked(config->hidePasswords());
|
||||
ViewHideUsernamesAction->setChecked(config->hideUsernames());
|
||||
ViewColumnsTitleAction->setChecked(EntryView->Columns[0]);
|
||||
ViewColumnsUsernameAction->setChecked(EntryView->Columns[1]);
|
||||
ViewColumnsUrlAction->setChecked(EntryView->Columns[2]);
|
||||
|
@ -274,36 +278,36 @@ void KeepassMainWindow::setupMenus(){
|
|||
ViewColumnsLastAccessAction->setChecked(EntryView->Columns[8]);
|
||||
ViewColumnsAttachmentAction->setChecked(EntryView->Columns[9]);
|
||||
ViewColumnsGroupAction->setChecked(EntryView->Columns[10]);
|
||||
ViewShowStatusbarAction->setChecked(config.ShowStatusbar);
|
||||
|
||||
switch(config.ToolbarIconSize){
|
||||
ViewShowStatusbarAction->setChecked(config->showStatusbar());
|
||||
|
||||
switch(config->toolbarIconSize()){
|
||||
case 16: ViewToolButtonSize16Action->setChecked(true); break;
|
||||
case 22: ViewToolButtonSize22Action->setChecked(true); break;
|
||||
case 28: ViewToolButtonSize28Action->setChecked(true); break;
|
||||
}
|
||||
|
||||
|
||||
SysTrayMenu = new QMenu(tr("KeePassX"),this);
|
||||
SysTrayMenu->addAction(FileExitAction);
|
||||
SysTray->setContextMenu(SysTrayMenu);
|
||||
|
||||
|
||||
#define _add_import(name){\
|
||||
QAction* import=new QAction(this);\
|
||||
import->setData(qVariantFromValue(dynamic_cast<QObject*>(&name)));\
|
||||
import->setText(name.title());\
|
||||
menuImport->addAction(import);}
|
||||
|
||||
|
||||
#define _add_export(name){\
|
||||
QAction* Export=new QAction(this);\
|
||||
Export->setData(qVariantFromValue(dynamic_cast<QObject*>(&name)));\
|
||||
Export->setText(name.title());\
|
||||
menuExport->addAction(Export);}
|
||||
|
||||
|
||||
_add_import(import_KeePassX_Xml)
|
||||
_add_import(import_PwManager)
|
||||
_add_import(import_KWalletXml)
|
||||
_add_export(export_Txt);
|
||||
_add_export(export_KeePassX_Xml);
|
||||
|
||||
|
||||
//FileNewMenu->setShortcut(tr("Ctrl+N"));
|
||||
FileOpenAction->setShortcut(tr("Ctrl+O"));
|
||||
FileSaveAction->setShortcut(tr("Ctrl+S"));
|
||||
|
@ -322,6 +326,8 @@ void KeepassMainWindow::setupMenus(){
|
|||
FileSaveAsAction->setShortcut(tr("Shift+Ctrl+S"));
|
||||
EditGroupSearchAction->setShortcut(tr("Shift+Ctrl+F"));
|
||||
#endif
|
||||
|
||||
ExtrasTrashCanAction->setVisible(false); //For KP 2.x only
|
||||
}
|
||||
|
||||
void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
|
||||
|
@ -336,8 +342,8 @@ void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
|
|||
|
||||
void KeepassMainWindow::openDatabase(QString filename,bool IsAuto){
|
||||
if(!IsAuto){
|
||||
config.LastKeyLocation=QString();
|
||||
config.LastKeyType=PASSWORD;}
|
||||
config->setLastKeyLocation(QString());
|
||||
config->setLastKeyType(PASSWORD);}
|
||||
db=dynamic_cast<IDatabase*>(new Kdb3Database());
|
||||
CPasswordDialog PasswordDlg(this,db,IsAuto,false);
|
||||
PasswordDlg.setWindowTitle(filename);
|
||||
|
@ -409,10 +415,10 @@ void KeepassMainWindow::OnFileNewKdb(){
|
|||
if(dlg.exec()==1){
|
||||
if(FileOpen)
|
||||
if(!closeDatabase())return;
|
||||
db=dynamic_cast<IDatabase*>(db_new);
|
||||
db=dynamic_cast<IDatabase*>(db_new);
|
||||
setWindowTitle(tr("%1 - KeePassX").arg(tr("[new]")));
|
||||
GroupView->db=db;
|
||||
EntryView->db=db;
|
||||
EntryView->db=db;
|
||||
GroupView->createItems();
|
||||
EntryView->showGroup(NULL);
|
||||
setStateFileOpen(true);
|
||||
|
@ -423,15 +429,15 @@ void KeepassMainWindow::OnFileNewKdb(){
|
|||
setStateEntrySelected(NONE);
|
||||
}
|
||||
else{
|
||||
delete db_new;
|
||||
delete db_new;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnFileNewKxdb(){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -526,7 +532,7 @@ void KeepassMainWindow::setStateGroupSelected(SelectionState s){
|
|||
EditDeleteGroupAction->setEnabled(false);
|
||||
EditGroupSearchAction->setEnabled(false);
|
||||
EditNewEntryAction->setEnabled(false);
|
||||
break;
|
||||
break;
|
||||
default: Q_ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
@ -536,15 +542,15 @@ void KeepassMainWindow::updateDetailView(){
|
|||
DetailView->setPlainText("");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QString templ=DetailViewTemplate;
|
||||
IEntryHandle* entry=((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle;
|
||||
|
||||
|
||||
templ.replace("%group%",entry->group()->title());
|
||||
templ.replace("%title%",entry->title());
|
||||
if(config.ListView_HideUsernames)templ.replace("%username%","****");
|
||||
else templ.replace("%username%",entry->username());
|
||||
if(!config.ListView_HidePasswords){
|
||||
if(config->hideUsernames())templ.replace("%username%","****");
|
||||
else templ.replace("%username%",entry->username());
|
||||
if(!config->hidePasswords()){
|
||||
SecString password=entry->password();
|
||||
password.unlock();
|
||||
templ.replace("%password%",password.string());
|
||||
|
@ -557,11 +563,11 @@ void KeepassMainWindow::updateDetailView(){
|
|||
templ.replace("%expire%",entry->expire().toString(Qt::LocalDate));
|
||||
templ.replace("%comment%",entry->comment());
|
||||
templ.replace("%attachment%",entry->binaryDesc());
|
||||
|
||||
|
||||
if(entry->expire()!=Date_Never){
|
||||
int secs=QDateTime::currentDateTime().secsTo(entry->expire());
|
||||
if(secs < 0)
|
||||
templ.replace("%expire-timeleft%",tr("expired"));
|
||||
templ.replace("%expire-timeleft%",tr("expired"));
|
||||
else{
|
||||
int years=0;
|
||||
int months=0;
|
||||
|
@ -571,21 +577,21 @@ void KeepassMainWindow::updateDetailView(){
|
|||
months=secs/(86400*30);
|
||||
secs-=months*(86400*30);
|
||||
days=secs/86400;
|
||||
|
||||
|
||||
QString out;
|
||||
|
||||
|
||||
if(months==1)
|
||||
out=tr("1 Month");
|
||||
out=tr("1 Month");
|
||||
if(months>1)
|
||||
out=tr("%1 Months").arg(months);
|
||||
|
||||
|
||||
if(years){
|
||||
if(out!=QString())
|
||||
out.prepend(tr(", "));
|
||||
if(years==1)
|
||||
out.prepend(tr("1 Year"));
|
||||
if(years>1)
|
||||
out.prepend(tr("%1 Years").arg(years));
|
||||
out.prepend(tr("%1 Years").arg(years));
|
||||
}
|
||||
else if(days){
|
||||
if(out!=QString())
|
||||
|
@ -593,18 +599,18 @@ void KeepassMainWindow::updateDetailView(){
|
|||
if(days==1)
|
||||
out.append(tr("1 Day"));
|
||||
if(days>1)
|
||||
out.append(tr("%1 Days").arg(days));
|
||||
out.append(tr("%1 Days").arg(days));
|
||||
}
|
||||
|
||||
|
||||
if(!days && !years && !months)
|
||||
out=tr("less than 1 day");
|
||||
|
||||
templ.replace("%expire-timeleft%",out);
|
||||
out=tr("less than 1 day");
|
||||
|
||||
templ.replace("%expire-timeleft%",out);
|
||||
}
|
||||
}
|
||||
else
|
||||
templ.replace("%expire-timeleft%","-");
|
||||
|
||||
|
||||
DetailView->setHtml(templ);
|
||||
}
|
||||
|
||||
|
@ -703,7 +709,7 @@ if(db->save())
|
|||
setStateFileModified(false);
|
||||
else{
|
||||
showErrMsg(tr("File could not be saved.\n%1").arg(db->getError()));
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -716,7 +722,7 @@ bool KeepassMainWindow::OnFileSaveAs(){
|
|||
showErrMsg(tr("File could not be saved.\n%1").arg(db->getError()));
|
||||
db->changeFile(QString());
|
||||
setWindowTitle(tr("KeePassX - [unsaved]").arg(filename));
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
setWindowTitle(tr("%1 - KeePassX").arg(filename));
|
||||
return OnFileSave();
|
||||
|
@ -740,7 +746,7 @@ void KeepassMainWindow::OnFileExit(){
|
|||
|
||||
|
||||
void KeepassMainWindow::OnExport(QAction* action){
|
||||
dynamic_cast<IExport*>(action->data().value<QObject*>())->exportDatabase(this,db);
|
||||
dynamic_cast<IExport*>(action->data().value<QObject*>())->exportDatabase(this,db);
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnImport(QAction* action){
|
||||
|
@ -767,7 +773,7 @@ void KeepassMainWindow::OnImport(QAction* action){
|
|||
}
|
||||
else
|
||||
delete tmpdb;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -802,7 +808,7 @@ void KeepassMainWindow::OnGroupSearch(){
|
|||
|
||||
void KeepassMainWindow::OnQuickSearch(){
|
||||
EntryView->SearchResults=db->search(NULL,QuickSearchEdit->text(),false,false,false,NULL);
|
||||
GroupView->showSearchResults();
|
||||
GroupView->showSearchResults();
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnColumnVisibilityChanged(QAction* action){
|
||||
|
@ -818,12 +824,12 @@ void KeepassMainWindow::OnColumnVisibilityChanged(QAction* action){
|
|||
EntryView->Columns[9]=ViewColumnsAttachmentAction->isChecked();
|
||||
EntryView->Columns[10]=ViewColumnsGroupAction->isChecked();
|
||||
EntryView->updateColumns();
|
||||
//if(FileOpen) EntryView->updateItems();
|
||||
if(FileOpen) EntryView->refreshItems();
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnUsernPasswVisibilityChanged(bool value){
|
||||
config.ListView_HidePasswords=ViewHidePasswordsAction->isChecked();
|
||||
config.ListView_HideUsernames=ViewHideUsernamesAction->isChecked();
|
||||
config->setHidePasswords(ViewHidePasswordsAction->isChecked());
|
||||
config->setHideUsernames(ViewHideUsernamesAction->isChecked());
|
||||
EntryView->refreshItems();
|
||||
}
|
||||
|
||||
|
@ -832,19 +838,19 @@ setStateFileModified(true);
|
|||
}
|
||||
|
||||
void KeepassMainWindow::closeEvent(QCloseEvent* e){
|
||||
if(!ShutingDown && config.MinimizeToTray){
|
||||
if(!ShutingDown && config->minimizeToTray()){
|
||||
e->ignore();
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
settings->setValue("Ui/MainWindowGeometry",QVariant(geometry()));
|
||||
settings->setValue("Ui/VSplitterPos",VSplitter->saveState());
|
||||
settings->setValue("Ui/HSplitterPos",HSplitter->saveState());
|
||||
config.ShowStatusbar=statusBar()->isVisible();
|
||||
|
||||
|
||||
config->setMainWindowGeometry(geometry());
|
||||
config->setVSplitterPos(VSplitter->saveState());
|
||||
config->setHSplitterPos(HSplitter->saveState());
|
||||
config->setShowStatusbar(statusBar()->isVisible());
|
||||
|
||||
if(FileOpen){
|
||||
if(!closeDatabase()){
|
||||
if(!closeDatabase()){
|
||||
ShutingDown=false;
|
||||
e->ignore();
|
||||
return;}
|
||||
|
@ -860,8 +866,8 @@ void KeepassMainWindow::closeEvent(QCloseEvent* e){
|
|||
void KeepassMainWindow::OnExtrasSettings(){
|
||||
CSettingsDlg dlg(this);
|
||||
if(dlg.exec()==QDialog::Accepted){
|
||||
EntryView->setAlternatingRowColors(config.AlternatingRowColors);
|
||||
SysTray->setVisible(config.ShowSysTrayIcon);
|
||||
EntryView->setAlternatingRowColors(config->alternatingRowColors());
|
||||
SysTray->setVisible(config->showSysTrayIcon());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -875,13 +881,13 @@ openBrowser(AppDir+"/../share/doc/keepass/index.html");
|
|||
}
|
||||
|
||||
void KeepassMainWindow::OnViewShowToolbar(bool show){
|
||||
config.Toolbar=show;
|
||||
toolBar->setVisible(config.Toolbar);
|
||||
config->setShowToolbar(show);
|
||||
toolBar->setVisible(show);
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnViewShowEntryDetails(bool show){
|
||||
config.EntryDetails=show;
|
||||
DetailView->setVisible(config.EntryDetails);
|
||||
config->setShowEntryDetails(show);
|
||||
DetailView->setVisible(show);
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnItemExpanded(QTreeWidgetItem* item){
|
||||
|
@ -896,7 +902,7 @@ void KeepassMainWindow::OnGroupSelectionChanged(IGroupHandle* group){
|
|||
if(group)
|
||||
setStateGroupSelected(SINGLE);
|
||||
else
|
||||
setStateGroupSelected(NONE);
|
||||
setStateGroupSelected(NONE);
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnEntryChanged(SelectionState Selection){
|
||||
|
@ -905,7 +911,7 @@ void KeepassMainWindow::OnEntryChanged(SelectionState Selection){
|
|||
}
|
||||
|
||||
void KeepassMainWindow::OnShowSearchResults(){
|
||||
setStateGroupSelected(SEARCHGROUP);
|
||||
setStateGroupSelected(SEARCHGROUP);
|
||||
}
|
||||
|
||||
|
||||
|
@ -913,24 +919,24 @@ void KeepassMainWindow::OnViewToolbarIconSize16(bool state){
|
|||
if(!state)return;
|
||||
ViewToolButtonSize22Action->setChecked(false);
|
||||
ViewToolButtonSize28Action->setChecked(false);
|
||||
config.ToolbarIconSize=16;
|
||||
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
|
||||
config->setToolbarIconSize(16);
|
||||
toolBar->setIconSize(QSize(16,16));
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnViewToolbarIconSize22(bool state){
|
||||
if(!state)return;
|
||||
ViewToolButtonSize16Action->setChecked(false);
|
||||
ViewToolButtonSize28Action->setChecked(false);
|
||||
config.ToolbarIconSize=22;
|
||||
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
|
||||
config->setToolbarIconSize(22);
|
||||
toolBar->setIconSize(QSize(22,22));
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnViewToolbarIconSize28(bool state){
|
||||
if(!state)return;
|
||||
ViewToolButtonSize16Action->setChecked(false);
|
||||
ViewToolButtonSize22Action->setChecked(false);
|
||||
config.ToolbarIconSize=28;
|
||||
toolBar->setIconSize(QSize(config.ToolbarIconSize,config.ToolbarIconSize));
|
||||
config->setToolbarIconSize(28);
|
||||
toolBar->setIconSize(QSize(28,28));
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason reason){
|
||||
|
@ -940,21 +946,21 @@ void KeepassMainWindow::OnSysTrayActivated(QSystemTrayIcon::ActivationReason rea
|
|||
|
||||
void KeepassMainWindow::OnExtrasPasswordGen(){
|
||||
CGenPwDialog dlg(this,true);
|
||||
dlg.exec();
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
|
||||
void KeepassMainWindow::saveLastFilename(const QString& filename){
|
||||
|
||||
if(settings->value("OpenLastFile",true).toBool()){
|
||||
if(settings->value("SaveRelativePath",true).toBool()){
|
||||
|
||||
if(config->openLastFile()){
|
||||
if(config->saveRelativePaths()){
|
||||
QString Path=filename.left(filename.lastIndexOf("/"));
|
||||
Path=makePathRelative(Path,QDir::currentPath());
|
||||
settings->setValue("LastFile",Path+filename.right(filename.length()-filename.lastIndexOf("/")-1));
|
||||
Path=makePathRelative(Path,QDir::currentPath());
|
||||
config->setLastFile(Path+filename.right(filename.length()-filename.lastIndexOf("/")-1));
|
||||
}
|
||||
else
|
||||
settings->setValue("LastFile",filename);
|
||||
}
|
||||
config->setLastFile(filename);
|
||||
}
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnExtrasShowExpiredEntries(){
|
||||
|
@ -963,5 +969,18 @@ void KeepassMainWindow::OnExtrasShowExpiredEntries(){
|
|||
GroupView->setCurrentGroup(dlg.SelectedEntry->group());
|
||||
EntryView->setCurrentEntry(dlg.SelectedEntry);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnExtrasTrashCan(){
|
||||
TrashCanDialog dlg(this,db,db->expiredEntries());
|
||||
if(dlg.exec()==QDialog::Accepted){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void KeepassMainWindow::OnDetailViewUrlClicked(const QUrl& url){
|
||||
openBrowser(url.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -38,9 +38,10 @@
|
|||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QUrl>
|
||||
|
||||
#include "StandardDatabase.h"
|
||||
#include "PwmConfig.h"
|
||||
#include "Kdb3Database.h"
|
||||
#include "KpxConfig.h"
|
||||
#include "lib/EntryView.h"
|
||||
#include "lib/GroupView.h"
|
||||
#include "export/Export.h"
|
||||
|
@ -53,10 +54,10 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
|
|||
KeepassMainWindow (const QString& ArgFile,QWidget *parent=0, Qt::WFlags flags=0);
|
||||
IDatabase* db;
|
||||
bool Start;
|
||||
|
||||
|
||||
signals:
|
||||
void entryChanged();
|
||||
|
||||
|
||||
private slots:
|
||||
void OnFileNewKdb();
|
||||
void OnFileNewKxdb();
|
||||
|
@ -82,6 +83,7 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
|
|||
void OnExtrasSettings();
|
||||
void OnExtrasPasswordGen();
|
||||
void OnExtrasShowExpiredEntries();
|
||||
void OnExtrasTrashCan();
|
||||
void OnHelpAbout();
|
||||
void OnHelpHandbook();
|
||||
void OnItemExpanded(QTreeWidgetItem*);
|
||||
|
@ -91,7 +93,8 @@ class KeepassMainWindow : public QMainWindow, public Ui_MainWindow{
|
|||
void OnSysTrayActivated(QSystemTrayIcon::ActivationReason);
|
||||
void OnImport(QAction*);
|
||||
void OnExport(QAction*);
|
||||
|
||||
void OnDetailViewUrlClicked(const QUrl& url);
|
||||
|
||||
private:
|
||||
void closeEvent(QCloseEvent* event);
|
||||
SelectionState GroupSelection, EntrySelection;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2005-2006 by Tarek Saidi *
|
||||
* Copyright (C) 2005-2007 by Tarek Saidi *
|
||||
* tarek.saidi@arcor.de *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
|
@ -27,12 +27,12 @@ class IFileDialog{
|
|||
public:
|
||||
virtual ~IFileDialog(){}
|
||||
virtual QString openExistingFileDialog(QWidget* parent,QString title,QString dir,
|
||||
QStringList Filters)=0;
|
||||
QStringList Filters,int SelectedFilter)=0;
|
||||
virtual QStringList openExistingFilesDialog(QWidget* parent,QString title,QString dir,
|
||||
QStringList Filters)=0;
|
||||
QStringList Filters,int SelectedFilter)=0;
|
||||
|
||||
virtual QString saveFileDialog(QWidget* parent,QString title,QString dir,
|
||||
QStringList Filters,bool ShowOverwriteWarning=true)=0;
|
||||
QStringList Filters,int SelectedFilter, bool ShowOverwriteWarning=true)=0;
|
||||
|
||||
virtual int getLastFilter()=0;
|
||||
};
|
||||
|
|
16
src/src.pro
16
src/src.pro
|
@ -11,7 +11,7 @@ DEPENDPATH += "crypto \
|
|||
translations \
|
||||
res"
|
||||
INSTALLS += target data
|
||||
data.files += ../share/keepass/*
|
||||
data.files += ../share/keepass/*
|
||||
TARGET = ../bin/keepassx
|
||||
|
||||
unix: !macx{
|
||||
|
@ -51,6 +51,7 @@ FORMS += forms/EditGroupDlg.ui \
|
|||
forms/CollectEntropyDlg.ui \
|
||||
forms/CustomizeDetailViewDlg.ui \
|
||||
forms/CalendarDlg.ui \
|
||||
forms/TrashCanDlg.ui \
|
||||
forms/ExpiredEntriesDlg.ui
|
||||
TRANSLATIONS += translations/keepass-de_DE.ts \
|
||||
translations/keepass-ru_RU.ts \
|
||||
|
@ -61,7 +62,7 @@ TRANSLATIONS += translations/keepass-de_DE.ts \
|
|||
HEADERS += lib/IniReader.h \
|
||||
lib/UrlLabel.h \
|
||||
mainwindow.h \
|
||||
StandardDatabase.h \
|
||||
Kdb3Database.h \
|
||||
lib/SecString.h \
|
||||
crypto/twoclass.h \
|
||||
crypto/twofish.h \
|
||||
|
@ -72,7 +73,6 @@ HEADERS += lib/IniReader.h \
|
|||
export/Export_KeePassX_Xml.h \
|
||||
export/Export.h \
|
||||
import/Import_KWalletXml.h \
|
||||
PwmConfig.h \
|
||||
dialogs/AboutDlg.h \
|
||||
dialogs/EditGroupDlg.h \
|
||||
dialogs/SearchDlg.h \
|
||||
|
@ -87,6 +87,7 @@ HEADERS += lib/IniReader.h \
|
|||
dialogs/CustomizeDetailViewDlg.h \
|
||||
dialogs/CalendarDlg.h \
|
||||
dialogs/ExpiredEntriesDlg.h \
|
||||
dialogs/TrashCanDlg.h \
|
||||
lib/random.h \
|
||||
Database.h \
|
||||
lib/KdePlugin.h \
|
||||
|
@ -112,12 +113,12 @@ HEADERS += lib/IniReader.h \
|
|||
plugins/interfaces/IFileDialog.h \
|
||||
plugins/interfaces/IKdeInit.h \
|
||||
plugins/interfaces/IGnomeInit.h \
|
||||
KpxConfig.h \
|
||||
KpxFirefox.h
|
||||
SOURCES += lib/IniReader.cpp \
|
||||
lib/UrlLabel.cpp \
|
||||
SOURCES += lib/UrlLabel.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
StandardDatabase.cpp \
|
||||
Kdb3Database.cpp \
|
||||
lib/SecString.cpp \
|
||||
crypto/twoclass.cpp \
|
||||
crypto/twofish.cpp \
|
||||
|
@ -130,7 +131,6 @@ SOURCES += lib/IniReader.cpp \
|
|||
export/Export_KeePassX_Xml.cpp \
|
||||
export/Export.cpp \
|
||||
import/Import_KWalletXml.cpp \
|
||||
PwmConfig.cpp \
|
||||
dialogs/AboutDlg.cpp \
|
||||
dialogs/EditGroupDlg.cpp \
|
||||
dialogs/SearchDlg.cpp \
|
||||
|
@ -145,6 +145,7 @@ SOURCES += lib/IniReader.cpp \
|
|||
dialogs/CustomizeDetailViewDlg.cpp \
|
||||
dialogs/CalendarDlg.cpp \
|
||||
dialogs/ExpiredEntriesDlg.cpp \
|
||||
dialogs/TrashCanDlg.cpp \
|
||||
lib/random.cpp \
|
||||
Database.cpp \
|
||||
lib/KdePlugin.cpp \
|
||||
|
@ -160,6 +161,7 @@ SOURCES += lib/IniReader.cpp \
|
|||
crypto/sha256.cpp \
|
||||
crypto/yarrow.cpp \
|
||||
lib/WaitAnimationWidget.cpp \
|
||||
KpxConfig.cpp \
|
||||
KpxFirefox.cpp
|
||||
RESOURCES += res/resources.qrc
|
||||
MOC_DIR = ../build/moc
|
||||
|
|
Loading…
Reference in New Issue