Fixed sorting of date columns (closes #1861726, #1922311)

Don't use entries in 'Backup' group for global auto-type (closes #1915664)

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@192 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent a2836d3183
commit d26d0e8f96
  1. 15
      src/lib/AutoType_X11.cpp
  2. 10
      src/lib/EntryView.cpp

@ -44,6 +44,7 @@ class AutoTypePrivate{
inline static void sleepKeyStrokeDelay(){ sleep(config->autoTypeKeyStrokeDelay()); }; inline static void sleepKeyStrokeDelay(){ sleep(config->autoTypeKeyStrokeDelay()); };
static void templateToKeysyms(const QString& Template, QList<AutoTypeAction>& KeySymList,IEntryHandle* entry); static void templateToKeysyms(const QString& Template, QList<AutoTypeAction>& KeySymList,IEntryHandle* entry);
static void stringToKeysyms(const QString& string,QList<AutoTypeAction>& KeySymList); static void stringToKeysyms(const QString& string,QList<AutoTypeAction>& KeySymList);
static QString getRootGroupName(IEntryHandle* entry);
}; };
@ -193,8 +194,11 @@ void AutoType::performGlobal(){
QRegExp lineMatch("Auto-Type-Window(?:-(\\d+)|):([^\\n]+)", Qt::CaseInsensitive, QRegExp::RegExp2); QRegExp lineMatch("Auto-Type-Window(?:-(\\d+)|):([^\\n]+)", Qt::CaseInsensitive, QRegExp::RegExp2);
QDateTime now = QDateTime::currentDateTime(); QDateTime now = QDateTime::currentDateTime();
for (int i=0; i<entries.size(); i++){ for (int i=0; i<entries.size(); i++){
if (entries[i]->expire()!=Date_Never && entries[i]->expire()<now) if ( (entries[i]->expire()!=Date_Never && entries[i]->expire()<now) ||
(AutoTypePrivate::getRootGroupName(entries[i]).compare("backup",Qt::CaseInsensitive)==0)
){
continue; continue;
}
bool hasWindowEntry=false; bool hasWindowEntry=false;
QString comment = entries[i]->comment(); QString comment = entries[i]->comment();
@ -564,3 +568,12 @@ void AutoTypePrivate::stringToKeysyms(const QString& string,QList<AutoTypeAction
for(int i=0; i<string.length();i++) for(int i=0; i<string.length();i++)
KeySymList << AutoTypeAction(TypeKey, HelperX11::getKeysym(string[i])); KeySymList << AutoTypeAction(TypeKey, HelperX11::getKeysym(string[i]));
} }
QString AutoTypePrivate::getRootGroupName(IEntryHandle* entry){
IGroupHandle* group = entry->group();
int level = group->level();
for (int i=0; i<level; i++)
group = group->parent();
return group->title();
}

@ -613,17 +613,13 @@ EntryViewItem::EntryViewItem(QTreeWidgetItem *parent, QTreeWidgetItem *preceding
bool EntryViewItem::operator<(const QTreeWidgetItem& other)const{ bool EntryViewItem::operator<(const QTreeWidgetItem& other)const{
int SortCol=treeWidget()->header()->sortIndicatorSection(); int SortCol=treeWidget()->header()->sortIndicatorSection();
int ListIndex=((KeepassEntryView*)treeWidget())->columnListIndex(SortCol); int ListIndex=((KeepassEntryView*)treeWidget())->columnListIndex(SortCol);
if(ListIndex < 5 || ListIndex==9 || ListIndex==10){ //columns with string values (Title, Username, Password, URL, Comment, Group) if(ListIndex < 5 || ListIndex > 8){ //columns with string values (Title, Username, Password, URL, Comment, Group)
if(QString::localeAwareCompare(text(SortCol),other.text(SortCol)) < 0) return (QString::localeAwareCompare(text(SortCol),other.text(SortCol)) < 0);
return true;
else
return false;
} }
KpxDateTime DateThis; KpxDateTime DateThis;
KpxDateTime DateOther; KpxDateTime DateOther;
switch(ListIndex){
switch(SortCol){
case 5: DateThis=EntryHandle->expire(); case 5: DateThis=EntryHandle->expire();
DateOther=((EntryViewItem&)other).EntryHandle->expire(); DateOther=((EntryViewItem&)other).EntryHandle->expire();
break; break;