Seperate columns/search order between normal and search results view (not yet complete)
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@324 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
671dcc2c30
commit
049ea5e5a2
|
@ -49,11 +49,8 @@ public:
|
||||||
QColor bannerColor2(){return stringToColor(settings.value("Options/BannerColor2","0,117,175").toString());}
|
QColor bannerColor2(){return stringToColor(settings.value("Options/BannerColor2","0,117,175").toString());}
|
||||||
QColor bannerTextColor(){return stringToColor(settings.value("Options/BannerTextColor","222,222,222").toString());}
|
QColor bannerTextColor(){return stringToColor(settings.value("Options/BannerTextColor","222,222,222").toString());}
|
||||||
int clipboardTimeOut(){return settings.value("Options/ClipboardTimeOut",20).toInt();}
|
int clipboardTimeOut(){return settings.value("Options/ClipboardTimeOut",20).toInt();}
|
||||||
QBitArray columns(){return stringToBitArray(settings.value("UI/Columns","11111000000").toString(),11);}
|
QByteArray entryView(){return settings.value("UI/EntryView").toByteArray();}
|
||||||
QList<int> columnOrder(){return stringToIntArray(settings.value("UI/ColumnOrder","100,100,100,100,100,100,100,100,100,100,100").toString(),11);}
|
QByteArray entryViewSearch(){return settings.value("UI/EntryViewSearch").toByteArray();}
|
||||||
QList<int> columnSizes(){return stringToIntArray(settings.value("UI/ColumnSizes","15,10,10,10,10,10,10,10,10,10,10").toString(),11);}
|
|
||||||
int columnSort(){return settings.value("UI/ColumnSort",0).toInt();}
|
|
||||||
Qt::SortOrder columnSortOrder(){return static_cast<Qt::SortOrder>(settings.value("UI/ColumnSortOrder",Qt::AscendingOrder).toInt());}
|
|
||||||
QStringList fileDlgHistory(unsigned index){return settings.value(QString("FileDlgHistory/ENTRY%1").arg(index)).toStringList();}
|
QStringList fileDlgHistory(unsigned index){return settings.value(QString("FileDlgHistory/ENTRY%1").arg(index)).toStringList();}
|
||||||
GrpTreeState groupTreeState(){return stringToGrpTreeState(settings.value("Options/GroupTreeState").toString());}
|
GrpTreeState groupTreeState(){return stringToGrpTreeState(settings.value("Options/GroupTreeState").toString());}
|
||||||
bool hidePasswords(){return settings.value("UI/HidePasswords",true).toBool();}
|
bool hidePasswords(){return settings.value("UI/HidePasswords",true).toBool();}
|
||||||
|
@ -115,11 +112,8 @@ public:
|
||||||
void setBannerColor2(const QColor& value){settings.setValue("Options/BannerColor2",colorToString(value));}
|
void setBannerColor2(const QColor& value){settings.setValue("Options/BannerColor2",colorToString(value));}
|
||||||
void setBannerTextColor(const QColor& value){settings.setValue("Options/BannerTextColor",colorToString(value));}
|
void setBannerTextColor(const QColor& value){settings.setValue("Options/BannerTextColor",colorToString(value));}
|
||||||
void setClipboardTimeOut(int value){settings.setValue("Options/ClipboardTimeOut",value);}
|
void setClipboardTimeOut(int value){settings.setValue("Options/ClipboardTimeOut",value);}
|
||||||
void setColumns(const QBitArray& value){settings.setValue("UI/Columns",bitArrayToString(value));}
|
void setEntryView(const QByteArray& value){settings.setValue("UI/EntryView",value);}
|
||||||
void setColumnOrder(const QList<int>& value){settings.setValue("UI/ColumnOrder",intArrayToString(value));}
|
void setEntryViewSearch(const QByteArray& value){settings.setValue("UI/EntryViewSearch",value);}
|
||||||
void setColumnSizes(const QList<int>& value){settings.setValue("UI/ColumnSizes",intArrayToString(value));}
|
|
||||||
void setColumnSort(int value){settings.setValue("UI/ColumnSort",value);}
|
|
||||||
void setColumnSortOrder(int value){settings.setValue("UI/ColumnSortOrder",value);}
|
|
||||||
void setFileDlgHistory(unsigned index,const QStringList& value){settings.setValue(QString("FileDlgHistory/ENTRY%1").arg(index), value);}
|
void setFileDlgHistory(unsigned index,const QStringList& value){settings.setValue(QString("FileDlgHistory/ENTRY%1").arg(index), value);}
|
||||||
void setGroupTreeState(GrpTreeState value){settings.setValue("Options/GroupTreeState",grpTreeStateToString(value));}
|
void setGroupTreeState(GrpTreeState value){settings.setValue("Options/GroupTreeState",grpTreeStateToString(value));}
|
||||||
void setHidePasswords(bool value){settings.setValue("UI/HidePasswords",value);}
|
void setHidePasswords(bool value){settings.setValue("UI/HidePasswords",value);}
|
||||||
|
|
|
@ -196,7 +196,6 @@
|
||||||
<string>&Columns</string>
|
<string>&Columns</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="ViewColumnsGroupAction"/>
|
<addaction name="ViewColumnsGroupAction"/>
|
||||||
<addaction name="separator"/>
|
|
||||||
<addaction name="ViewColumnsTitleAction"/>
|
<addaction name="ViewColumnsTitleAction"/>
|
||||||
<addaction name="ViewColumnsUsernameAction"/>
|
<addaction name="ViewColumnsUsernameAction"/>
|
||||||
<addaction name="ViewColumnsUrlAction"/>
|
<addaction name="ViewColumnsUrlAction"/>
|
||||||
|
@ -539,11 +538,11 @@
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Group (search results only)</string>
|
<string>&Group</string>
|
||||||
|
</property>
|
||||||
|
<property name="visible">
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="ExtrasShowExpiredEntriesAction">
|
<action name="ExtrasShowExpiredEntriesAction">
|
||||||
|
|
|
@ -20,49 +20,132 @@
|
||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "lib/AutoType.h"
|
#include "lib/AutoType.h"
|
||||||
#include "lib/EntryView.h"
|
#include "lib/EntryView.h"
|
||||||
#include "dialogs/EditEntryDlg.h"
|
#include "dialogs/EditEntryDlg.h"
|
||||||
|
|
||||||
// just for the lessThan funtion
|
// just for the lessThan funtion
|
||||||
QList<EntryViewItem*>* pItems;
|
/*QList<EntryViewItem*>* pItems;
|
||||||
KeepassEntryView* pEntryView;
|
KeepassEntryView* pEntryView;*/
|
||||||
|
|
||||||
KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
|
KeepassEntryView::KeepassEntryView(QWidget* parent):QTreeWidget(parent){
|
||||||
ViewMode=Normal;
|
ViewMode=Normal;
|
||||||
AutoResizeColumns=true;
|
|
||||||
header()->setResizeMode(QHeaderView::Interactive);
|
header()->setResizeMode(QHeaderView::Interactive);
|
||||||
header()->setStretchLastSection(false);
|
header()->setStretchLastSection(false);
|
||||||
header()->setClickable(true);
|
header()->setClickable(true);
|
||||||
header()->setCascadingSectionResizes(true);
|
//header()->setCascadingSectionResizes(true);
|
||||||
ColumnSizes=config->columnSizes();
|
retranslateColumns();
|
||||||
Columns=config->columns();
|
restoreHeaderView();
|
||||||
ColumnOrder=config->columnOrder();
|
|
||||||
|
|
||||||
updateColumns();
|
connect(this,SIGNAL(itemSelectionChanged()), SLOT(OnItemsChanged()));
|
||||||
header()->setSortIndicator(config->columnSort(), config->columnSortOrder());
|
connect(&ClipboardTimer, SIGNAL(timeout()), SLOT(OnClipboardTimeOut()));
|
||||||
|
connect(this, SIGNAL(itemActivated(QTreeWidgetItem*,int)), SLOT(OnEntryActivated(QTreeWidgetItem*,int)));
|
||||||
connect(header(),SIGNAL(sectionResized(int,int,int)),this,SLOT(OnColumnResized()));
|
connect(this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), SLOT(OnEntryDblClicked(QTreeWidgetItem*,int)));
|
||||||
connect(this,SIGNAL(itemSelectionChanged()),this,SLOT(OnItemsChanged()));
|
|
||||||
connect(&ClipboardTimer, SIGNAL(timeout()), this, SLOT(OnClipboardTimeOut()));
|
|
||||||
connect(header(),SIGNAL(sectionClicked(int)),this,SLOT(OnHeaderSectionClicked(int)));
|
|
||||||
connect(header(),SIGNAL(sectionMoved(int,int,int)),this,SLOT(OnColumnMoved()));
|
|
||||||
Clipboard=QApplication::clipboard();
|
Clipboard=QApplication::clipboard();
|
||||||
ContextMenu=new QMenu(this);
|
ContextMenu=new QMenu(this);
|
||||||
setAlternatingRowColors(config->alternatingRowColors());
|
setAlternatingRowColors(config->alternatingRowColors());
|
||||||
|
|
||||||
pItems=&Items;
|
/*pItems=&Items;
|
||||||
pEntryView=this;
|
pEntryView=this;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
KeepassEntryView::~KeepassEntryView(){
|
KeepassEntryView::~KeepassEntryView(){
|
||||||
config->setColumnSizes(ColumnSizes);
|
saveHeaderView();
|
||||||
config->setColumns(Columns);
|
}
|
||||||
config->setColumnOrder(ColumnOrder);
|
|
||||||
config->setColumnSort(header()->sortIndicatorSection());
|
void KeepassEntryView::retranslateColumns() {
|
||||||
config->setColumnSortOrder(header()->sortIndicatorOrder());
|
setHeaderLabels( QStringList() << tr("Title") << tr("Username") << tr("URL") << tr("Password") << tr("Comments")
|
||||||
|
<< tr("Expires") << tr("Creation") << tr("Last Change") << tr("Last Access") << tr("Attachment") << tr("Group") );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KeepassEntryView::columnVisible(int col) {
|
||||||
|
return !header()->isSectionHidden(col);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeepassEntryView::setColumnVisible(int col, bool visible) {
|
||||||
|
header()->setSectionHidden(col, !visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeepassEntryView::saveHeaderView() {
|
||||||
|
if (ViewMode == Normal)
|
||||||
|
config->setEntryView( header()->saveState() );
|
||||||
|
else
|
||||||
|
config->setEntryViewSearch( header()->saveState() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeepassEntryView::restoreHeaderView() {
|
||||||
|
if (ViewMode == Normal) {
|
||||||
|
QByteArray state = config->entryView();
|
||||||
|
if (state.isEmpty()) {
|
||||||
|
for (int i=10; i>=0; --i) {
|
||||||
|
if (i <= 3) {
|
||||||
|
setColumnVisible(i, true);
|
||||||
|
header()->moveSection(header()->visualIndex(i), 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setColumnVisible(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||||
|
header()->setSortIndicatorShown(true);
|
||||||
|
header()->resizeSection(0, (int) (header()->sectionSize(0) * 1.5));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header()->restoreState(state);
|
||||||
|
setColumnVisible(10, false); // just to be sure
|
||||||
|
|
||||||
|
QApplication::processEvents();
|
||||||
|
|
||||||
|
//QHash<int, int> sectionSize;
|
||||||
|
QList<int> visibleSections;
|
||||||
|
for (int i=0; i<=10; ++i) {
|
||||||
|
if (columnVisible(i)) {
|
||||||
|
qDebug("%d",i);
|
||||||
|
visibleSections.append(i);
|
||||||
|
header()->hideSection(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QApplication::processEvents();
|
||||||
|
|
||||||
|
for (int i=0; i<visibleSections.size(); ++i) {
|
||||||
|
qDebug("%d",visibleSections[i]);
|
||||||
|
header()->showSection(visibleSections[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for (int i=0; i<=10; ++i) {
|
||||||
|
if (columnVisible(i)) {
|
||||||
|
int size = header()->sectionSize(i);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
header()->resizeSection(i, 1);
|
||||||
|
header()->resizeSection(i, size);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QByteArray state = config->entryViewSearch();
|
||||||
|
if (state.isEmpty()) {
|
||||||
|
for (int i=10; i>=0; --i) {
|
||||||
|
if (i <= 3 || i == 10) {
|
||||||
|
setColumnVisible(i, true);
|
||||||
|
header()->moveSection(header()->visualIndex(i), 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setColumnVisible(i, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header()->moveSection(header()->visualIndex(10), 0);
|
||||||
|
header()->setSortIndicator(10, Qt::AscendingOrder);
|
||||||
|
header()->setSortIndicatorShown(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
header()->restoreState(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::OnGroupChanged(IGroupHandle* group){
|
void KeepassEntryView::OnGroupChanged(IGroupHandle* group){
|
||||||
|
@ -75,7 +158,6 @@ void KeepassEntryView::OnShowSearchResults(){
|
||||||
showSearchResults();
|
showSearchResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::OnItemsChanged(){
|
void KeepassEntryView::OnItemsChanged(){
|
||||||
switch(selectedItems().size()){
|
switch(selectedItems().size()){
|
||||||
case 0: emit selectionChanged(NONE);
|
case 0: emit selectionChanged(NONE);
|
||||||
|
@ -86,40 +168,6 @@ void KeepassEntryView::OnItemsChanged(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sortSearchResultsLessThan(const IEntryHandle* a, const IEntryHandle* b){
|
|
||||||
int indexA, indexB;
|
|
||||||
for(indexA=0;indexA<pItems->size();indexA++){
|
|
||||||
if((*pItems)[indexA]->EntryHandle==a)break;
|
|
||||||
}
|
|
||||||
for(indexB=0;indexB<pItems->size();indexB++){
|
|
||||||
if((*pItems)[indexB]->EntryHandle==b)break;
|
|
||||||
}
|
|
||||||
return pEntryView->indexOfTopLevelItem((*pItems)[indexA])<pEntryView->indexOfTopLevelItem((*pItems)[indexB]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::OnHeaderSectionClicked(int index){
|
|
||||||
if(header()->sortIndicatorSection()==index){
|
|
||||||
header()->setSortIndicator(index,header()->sortIndicatorOrder() ? Qt::DescendingOrder : Qt::AscendingOrder);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
header()->setSortIndicator(index,Qt::AscendingOrder);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ViewMode==Normal){
|
|
||||||
for(int i=0;i<Items.size();i++){
|
|
||||||
Items[i]->EntryHandle->setVisualIndexDirectly(indexOfTopLevelItem(Items[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(ViewMode==ShowSearchResults){
|
|
||||||
if(header()->sortIndicatorOrder()==Qt::AscendingOrder)
|
|
||||||
qSort(SearchResults.begin(),SearchResults.end(),sortSearchResultsLessThan);
|
|
||||||
else
|
|
||||||
qSort(SearchResults.end(),SearchResults.begin(),sortSearchResultsLessThan);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KeepassEntryView::OnSaveAttachment(){
|
void KeepassEntryView::OnSaveAttachment(){
|
||||||
if (selectedItems().size() == 0) return;
|
if (selectedItems().size() == 0) return;
|
||||||
CEditEntryDlg::saveAttachment(((EntryViewItem*)selectedItems().first())->EntryHandle,this);
|
CEditEntryDlg::saveAttachment(((EntryViewItem*)selectedItems().first())->EntryHandle,this);
|
||||||
|
@ -181,45 +229,32 @@ void KeepassEntryView::OnDeleteEntry(){
|
||||||
void KeepassEntryView::updateEntry(EntryViewItem* item){
|
void KeepassEntryView::updateEntry(EntryViewItem* item){
|
||||||
IEntryHandle* entry = item->EntryHandle;
|
IEntryHandle* entry = item->EntryHandle;
|
||||||
int j=0;
|
int j=0;
|
||||||
if(Columns.at(0)){
|
item->setText(j++,entry->title());
|
||||||
item->setText(j++,entry->title());
|
item->setIcon(0,db->icon(entry->image()));
|
||||||
item->setIcon(0,db->icon(entry->image()));
|
if(config->hideUsernames())
|
||||||
|
item->setText(j++,"******");
|
||||||
|
else
|
||||||
|
item->setText(j++,entry->username());
|
||||||
|
item->setText(j++,entry->url());
|
||||||
|
if(config->hidePasswords())
|
||||||
|
item->setText(j++,"******");
|
||||||
|
else{
|
||||||
|
SecString password=entry->password();
|
||||||
|
password.unlock();
|
||||||
|
item->setText(j++,password.string());
|
||||||
}
|
}
|
||||||
if (Columns.at(1)){
|
QString comment = entry->comment();
|
||||||
if(config->hideUsernames())
|
int toPos = comment.indexOf(QRegExp("[\\r\\n]"));
|
||||||
item->setText(j++,"******");
|
if (toPos == -1)
|
||||||
else
|
item->setText(j++,comment);
|
||||||
item->setText(j++,entry->username());
|
else
|
||||||
}
|
item->setText(j++,comment.left(toPos));
|
||||||
if (Columns.at(2)){item->setText(j++,entry->url());}
|
item->setText(j++,entry->expire().dateToString(Qt::SystemLocaleDate));
|
||||||
if (Columns.at(3)){
|
item->setText(j++,entry->creation().dateToString(Qt::SystemLocaleDate));
|
||||||
if(config->hidePasswords())
|
item->setText(j++,entry->lastMod().dateToString(Qt::SystemLocaleDate));
|
||||||
item->setText(j++,"******");
|
item->setText(j++,entry->lastAccess().dateToString(Qt::SystemLocaleDate));
|
||||||
else{
|
item->setText(j++,entry->binaryDesc());
|
||||||
SecString password=entry->password();
|
if (ViewMode == ShowSearchResults) {
|
||||||
password.unlock();
|
|
||||||
item->setText(j++,password.string());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Columns.at(4)){
|
|
||||||
QString comment = entry->comment();
|
|
||||||
int toPos = comment.indexOf(QRegExp("[\\r\\n]"));
|
|
||||||
if (toPos == -1)
|
|
||||||
item->setText(j++,comment);
|
|
||||||
else
|
|
||||||
item->setText(j++,comment.left(toPos));
|
|
||||||
}
|
|
||||||
if (Columns.at(5)){
|
|
||||||
item->setText(j++,entry->expire().dateToString(Qt::SystemLocaleDate));}
|
|
||||||
if (Columns.at(6)){
|
|
||||||
item->setText(j++,entry->creation().dateToString(Qt::SystemLocaleDate));}
|
|
||||||
if (Columns.at(7)){
|
|
||||||
item->setText(j++,entry->lastMod().dateToString(Qt::SystemLocaleDate));}
|
|
||||||
if (Columns.at(8)){
|
|
||||||
item->setText(j++,entry->lastAccess().dateToString(Qt::SystemLocaleDate));}
|
|
||||||
if (Columns.at(9)){
|
|
||||||
item->setText(j++,entry->binaryDesc());}
|
|
||||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
|
||||||
item->setText(j,entry->group()->title());
|
item->setText(j,entry->group()->title());
|
||||||
item->setIcon(j++,db->icon(entry->group()->image()));
|
item->setIcon(j++,db->icon(entry->group()->image()));
|
||||||
}
|
}
|
||||||
|
@ -288,10 +323,10 @@ void KeepassEntryView::OnNewEntry(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
|
void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item, int Column){
|
||||||
Q_UNUSED(item);
|
Q_UNUSED(item);
|
||||||
|
|
||||||
switch (columnListIndex(Column)){
|
switch (Column){
|
||||||
case 1:
|
case 1:
|
||||||
OnUsernameToClipboard();
|
OnUsernameToClipboard();
|
||||||
break;
|
break;
|
||||||
|
@ -304,8 +339,8 @@ void KeepassEntryView::OnEntryActivated(QTreeWidgetItem* item,int Column){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::OnEntryDblClicked(QTreeWidgetItem* item,int Column){
|
void KeepassEntryView::OnEntryDblClicked(QTreeWidgetItem* item, int Column){
|
||||||
if (columnListIndex(Column) == 0)
|
if (Column == 0)
|
||||||
editEntry((EntryViewItem*)item);
|
editEntry((EntryViewItem*)item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +406,8 @@ void KeepassEntryView::OnClipboardTimeOut(){
|
||||||
}
|
}
|
||||||
#ifdef Q_WS_X11
|
#ifdef Q_WS_X11
|
||||||
QProcess::startDetached("dcop klipper klipper clearClipboardHistory");
|
QProcess::startDetached("dcop klipper klipper clearClipboardHistory");
|
||||||
QProcess::startDetached("dbus-send --type=method_call --dest=org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory");
|
QProcess::startDetached("dbus-send --type=method_call --dest=org.kde.klipper /klipper "
|
||||||
|
"org.kde.klipper.klipper.clearClipboardHistory");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,16 +436,17 @@ void KeepassEntryView::contextMenuEvent(QContextMenuEvent* e){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::resizeEvent(QResizeEvent* e){
|
void KeepassEntryView::resizeEvent(QResizeEvent* e){
|
||||||
resizeColumns();
|
// TODO resizeColumns();
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::showSearchResults(){
|
void KeepassEntryView::showSearchResults(){
|
||||||
if(ViewMode==Normal){
|
if(ViewMode == Normal){
|
||||||
ViewMode=ShowSearchResults;
|
saveHeaderView();
|
||||||
if(Columns.at(10))ColumnOrder[10]--;
|
ViewMode = ShowSearchResults;
|
||||||
updateColumns();
|
restoreHeaderView();
|
||||||
|
emit viewModeChanged(true);
|
||||||
}
|
}
|
||||||
clear();
|
clear();
|
||||||
Items.clear();
|
Items.clear();
|
||||||
|
@ -418,9 +455,11 @@ void KeepassEntryView::showSearchResults(){
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::showGroup(IGroupHandle* group){
|
void KeepassEntryView::showGroup(IGroupHandle* group){
|
||||||
if(ViewMode==ShowSearchResults){
|
if(ViewMode == ShowSearchResults){
|
||||||
ViewMode=Normal;
|
saveHeaderView();
|
||||||
updateColumns();
|
ViewMode = Normal;
|
||||||
|
restoreHeaderView();
|
||||||
|
emit viewModeChanged(false);
|
||||||
}
|
}
|
||||||
clear();
|
clear();
|
||||||
Items.clear();
|
Items.clear();
|
||||||
|
@ -436,45 +475,35 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
|
||||||
Items.push_back(item);
|
Items.push_back(item);
|
||||||
Items.back()->EntryHandle=entries[i];
|
Items.back()->EntryHandle=entries[i];
|
||||||
int j=0;
|
int j=0;
|
||||||
if (Columns.at(0)){
|
item->setText(j++,entries[i]->title());
|
||||||
item->setText(j++,entries[i]->title());
|
item->setIcon(0,db->icon(entries[i]->image()));
|
||||||
item->setIcon(0,db->icon(entries[i]->image()));}
|
if(config->hideUsernames())
|
||||||
if (Columns.at(1)){
|
item->setText(j++,"******");
|
||||||
if(config->hideUsernames())
|
else
|
||||||
item->setText(j++,"******");
|
item->setText(j++,entries[i]->username());
|
||||||
else
|
item->setText(j++,entries[i]->url());
|
||||||
item->setText(j++,entries[i]->username());}
|
if(config->hidePasswords())
|
||||||
if (Columns.at(2)){item->setText(j++,entries[i]->url());}
|
item->setText(j++,"******");
|
||||||
if (Columns.at(3)){
|
else{
|
||||||
if(config->hidePasswords())
|
SecString password=entries[i]->password();
|
||||||
item->setText(j++,"******");
|
password.unlock();
|
||||||
else{
|
item->setText(j++,password.string());
|
||||||
SecString password=entries[i]->password();
|
|
||||||
password.unlock();
|
|
||||||
item->setText(j++,password.string());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (Columns.at(4)){
|
QString comment = entries[i]->comment();
|
||||||
QString comment = entries[i]->comment();
|
int toPos = comment.indexOf(QRegExp("[\\r\\n]"));
|
||||||
int toPos = comment.indexOf(QRegExp("[\\r\\n]"));
|
if (toPos == -1)
|
||||||
if (toPos == -1)
|
item->setText(j++,comment);
|
||||||
item->setText(j++,comment);
|
else
|
||||||
else
|
item->setText(j++,comment.left(toPos));
|
||||||
item->setText(j++,comment.left(toPos));
|
item->setText(j++,entries[i]->expire().dateToString(Qt::SystemLocaleDate));
|
||||||
}
|
item->setText(j++,entries[i]->creation().dateToString(Qt::SystemLocaleDate));
|
||||||
if (Columns.at(5)){
|
item->setText(j++,entries[i]->lastMod().dateToString(Qt::SystemLocaleDate));
|
||||||
item->setText(j++,entries[i]->expire().dateToString(Qt::SystemLocaleDate));}
|
item->setText(j++,entries[i]->lastAccess().dateToString(Qt::SystemLocaleDate));
|
||||||
if (Columns.at(6)){
|
item->setText(j++,entries[i]->binaryDesc());
|
||||||
item->setText(j++,entries[i]->creation().dateToString(Qt::SystemLocaleDate));}
|
if (ViewMode == ShowSearchResults) {
|
||||||
if (Columns.at(7)){
|
|
||||||
item->setText(j++,entries[i]->lastMod().dateToString(Qt::SystemLocaleDate));}
|
|
||||||
if (Columns.at(8)){
|
|
||||||
item->setText(j++,entries[i]->lastAccess().dateToString(Qt::SystemLocaleDate));}
|
|
||||||
if (Columns.at(9)){
|
|
||||||
item->setText(j++,entries[i]->binaryDesc());}
|
|
||||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
|
||||||
item->setText(j,entries[i]->group()->title());
|
item->setText(j,entries[i]->group()->title());
|
||||||
item->setIcon(j++,db->icon(entries[i]->group()->image()));}
|
item->setIcon(j++,db->icon(entries[i]->group()->image()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,137 +513,11 @@ void KeepassEntryView::updateIcons(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*void KeepassEntryView::setEntry(IEntryHandle* entry){
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void KeepassEntryView::updateColumns(){
|
|
||||||
setColumnCount(0);
|
|
||||||
QStringList cols;
|
|
||||||
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.at(i))
|
|
||||||
ColumnOrder[i]=100;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMap<int,int> Order;
|
|
||||||
for(int i=NUM_COLUMNS-1;i>=0;i--)
|
|
||||||
Order.insertMulti(ColumnOrder.at(i),i);
|
|
||||||
|
|
||||||
QMapIterator<int, int> i(Order);
|
|
||||||
while (i.hasNext()) {
|
|
||||||
i.next();
|
|
||||||
int index=i.value();
|
|
||||||
if(!Columns.at(index))continue;
|
|
||||||
header()->moveSection(header()->visualIndex(logicalColIndex(index)),header()->count()-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
resizeColumns();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KeepassEntryView::refreshItems(){
|
void KeepassEntryView::refreshItems(){
|
||||||
for (int i=0;i<Items.size();i++)
|
for (int i=0;i<Items.size();i++)
|
||||||
updateEntry(Items.at(i));
|
updateEntry(Items.at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassEntryView::OnColumnMoved(){
|
|
||||||
for(int i=0;i<header()->count();i++){
|
|
||||||
ColumnOrder[columnListIndex(header()->logicalIndex(i))]=i;
|
|
||||||
}
|
|
||||||
sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
|
|
||||||
}
|
|
||||||
|
|
||||||
int KeepassEntryView::logicalColIndex(int LstIndex){
|
|
||||||
int c=-1;
|
|
||||||
for(int i=0;i<NUM_COLUMNS;i++){
|
|
||||||
if(Columns.at(i))
|
|
||||||
c++;
|
|
||||||
if(i==10 && Columns.at(10) && ViewMode!=ShowSearchResults)
|
|
||||||
c--;
|
|
||||||
if(i==LstIndex)
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
Q_ASSERT(false);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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.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.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.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;
|
|
||||||
for(i=0;i<NUM_COLUMNS;i++){
|
|
||||||
if(Columns.at(i))
|
|
||||||
c++;
|
|
||||||
if(i==10 && Columns.at(10) && ViewMode!=ShowSearchResults)
|
|
||||||
c--;
|
|
||||||
if(c==LogicalIndex)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void KeepassEntryView::OnColumnResized(){
|
|
||||||
if(!AutoResizeColumns)return;
|
|
||||||
for(int i=0;i<header()->count();i++){
|
|
||||||
ColumnSizes[columnListIndex(i)]=header()->sectionSize(i);
|
|
||||||
}
|
|
||||||
resizeColumns();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KeepassEntryView::mousePressEvent(QMouseEvent *event){
|
void KeepassEntryView::mousePressEvent(QMouseEvent *event){
|
||||||
//save event position - maybe this is the start of a drag
|
//save event position - maybe this is the start of a drag
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
|
@ -710,7 +613,7 @@ 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())->header()->logicalIndex(SortCol);
|
||||||
|
|
||||||
int comp = compare(other, SortCol, ListIndex);
|
int comp = compare(other, SortCol, ListIndex);
|
||||||
if (comp!=0)
|
if (comp!=0)
|
||||||
|
@ -720,7 +623,7 @@ bool EntryViewItem::operator<(const QTreeWidgetItem& other) const{
|
||||||
int ListIndexOrg = ListIndex;
|
int ListIndexOrg = ListIndex;
|
||||||
for (int i=0; i<visibleCols; i++){
|
for (int i=0; i<visibleCols; i++){
|
||||||
SortCol = treeWidget()->header()->logicalIndex(i);
|
SortCol = treeWidget()->header()->logicalIndex(i);
|
||||||
ListIndex = ((KeepassEntryView*)treeWidget())->columnListIndex(SortCol);
|
ListIndex = ((KeepassEntryView*)treeWidget())->header()->logicalIndex(SortCol);
|
||||||
if (ListIndex==ListIndexOrg || ListIndex==3) // sort or password column
|
if (ListIndex==ListIndexOrg || ListIndex==3) // sort or password column
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
#include "Kdb3Database.h"
|
#include "Kdb3Database.h"
|
||||||
|
|
||||||
#define NUM_COLUMNS 11
|
|
||||||
|
|
||||||
class EntryViewItem;
|
class EntryViewItem;
|
||||||
class GroupViewItem;
|
class GroupViewItem;
|
||||||
enum SelectionState{NONE,SINGLE,MULTIPLE,SEARCHGROUP};
|
enum SelectionState{NONE,SINGLE,MULTIPLE,SEARCHGROUP};
|
||||||
|
@ -36,36 +34,32 @@ class KeepassEntryView:public QTreeWidget{
|
||||||
~KeepassEntryView();
|
~KeepassEntryView();
|
||||||
void showSearchResults();
|
void showSearchResults();
|
||||||
void showGroup(IGroupHandle* group);
|
void showGroup(IGroupHandle* group);
|
||||||
void updateColumns();
|
|
||||||
void refreshItems();
|
void refreshItems();
|
||||||
int columnListIndex(int LogicalIndex);
|
void retranslateColumns();
|
||||||
IDatabase* db;
|
IDatabase* db;
|
||||||
QList<EntryViewItem*>Items;
|
QList<EntryViewItem*>Items;
|
||||||
QList<IEntryHandle*> SearchResults;
|
QList<IEntryHandle*> SearchResults;
|
||||||
QMenu *ContextMenu;
|
QMenu *ContextMenu;
|
||||||
QBitArray Columns;
|
|
||||||
void setCurrentEntry(IEntryHandle* entry);
|
void setCurrentEntry(IEntryHandle* entry);
|
||||||
inline IGroupHandle* getCurrentGroup() { return CurrentGroup; };
|
inline IGroupHandle* getCurrentGroup() { return CurrentGroup; };
|
||||||
|
bool columnVisible(int col);
|
||||||
|
void setColumnVisible(int col, bool visible);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//void setEntry(IEntryHandle* entry);
|
|
||||||
void updateEntry(EntryViewItem*);
|
|
||||||
void editEntry(EntryViewItem*);
|
|
||||||
void createItems(QList<IEntryHandle*>& entries);
|
|
||||||
int logicalColIndex(int ListIndex);
|
|
||||||
|
|
||||||
QClipboard* Clipboard;
|
QClipboard* Clipboard;
|
||||||
QTimer ClipboardTimer;
|
QTimer ClipboardTimer;
|
||||||
void resizeColumns();
|
|
||||||
bool AutoResizeColumns;
|
|
||||||
QPoint DragStartPos;
|
QPoint DragStartPos;
|
||||||
QList<QTreeWidgetItem*> DragItems;
|
QList<QTreeWidgetItem*> DragItems;
|
||||||
IGroupHandle* CurrentGroup;
|
IGroupHandle* CurrentGroup;
|
||||||
enum EntryViewMode {Normal, ShowSearchResults};
|
enum EntryViewMode {Normal, ShowSearchResults};
|
||||||
EntryViewMode ViewMode;
|
EntryViewMode ViewMode;
|
||||||
QList<int> ColumnSizes;
|
|
||||||
QList<int> ColumnOrder;
|
void updateEntry(EntryViewItem*);
|
||||||
float GroupColumnSize;
|
void editEntry(EntryViewItem*);
|
||||||
|
void createItems(QList<IEntryHandle*>& entries);
|
||||||
|
void saveHeaderView();
|
||||||
|
void restoreHeaderView();
|
||||||
|
|
||||||
void contextMenuEvent(QContextMenuEvent *event);
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
void paintEvent(QPaintEvent* event);
|
void paintEvent(QPaintEvent* event);
|
||||||
void resizeEvent(QResizeEvent* event);
|
void resizeEvent(QResizeEvent* event);
|
||||||
|
@ -73,8 +67,6 @@ class KeepassEntryView:public QTreeWidget{
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnColumnResized();
|
|
||||||
void OnHeaderSectionClicked(int index);
|
|
||||||
void OnGroupChanged(IGroupHandle* group);
|
void OnGroupChanged(IGroupHandle* group);
|
||||||
void OnShowSearchResults();
|
void OnShowSearchResults();
|
||||||
void OnEntryActivated(QTreeWidgetItem*,int);
|
void OnEntryActivated(QTreeWidgetItem*,int);
|
||||||
|
@ -93,7 +85,6 @@ class KeepassEntryView:public QTreeWidget{
|
||||||
void OnAutoType();
|
void OnAutoType();
|
||||||
#endif
|
#endif
|
||||||
void removeDragItems();
|
void removeDragItems();
|
||||||
void OnColumnMoved();
|
|
||||||
void OnEditOpenUrl();
|
void OnEditOpenUrl();
|
||||||
void OnEditCopyUrl();
|
void OnEditCopyUrl();
|
||||||
|
|
||||||
|
@ -101,6 +92,7 @@ class KeepassEntryView:public QTreeWidget{
|
||||||
void fileModified();
|
void fileModified();
|
||||||
void selectionChanged(SelectionState);
|
void selectionChanged(SelectionState);
|
||||||
void requestCreateGroup(QString title, quint32 image, GroupViewItem* parent);
|
void requestCreateGroup(QString title, quint32 image, GroupViewItem* parent);
|
||||||
|
void viewModeChanged(bool searchResultMode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ KeepassGroupView::KeepassGroupView(QWidget* parent):QTreeWidget(parent){
|
||||||
connect(this,SIGNAL(itemCollapsed(QTreeWidgetItem*)),this,SLOT(OnItemCollapsed(QTreeWidgetItem*)));
|
connect(this,SIGNAL(itemCollapsed(QTreeWidgetItem*)),this,SLOT(OnItemCollapsed(QTreeWidgetItem*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void KeepassGroupView::createItems(){
|
void KeepassGroupView::createItems(){
|
||||||
clear();
|
clear();
|
||||||
Items.clear();
|
Items.clear();
|
||||||
|
@ -55,6 +54,10 @@ void KeepassGroupView::createItems(){
|
||||||
Items[i]->setExpanded(Items[i]->GroupHandle->expanded());
|
Items[i]->setExpanded(Items[i]->GroupHandle->expanded());
|
||||||
}
|
}
|
||||||
SearchResultItem=new GroupViewItem();
|
SearchResultItem=new GroupViewItem();
|
||||||
|
retranslateUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
void KeepassGroupView::retranslateUi() {
|
||||||
SearchResultItem->setText(0,tr("Search Results"));
|
SearchResultItem->setText(0,tr("Search Results"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ class KeepassGroupView:public QTreeWidget{
|
||||||
void showSearchResults();
|
void showSearchResults();
|
||||||
void setCurrentGroup(IGroupHandle* group);
|
void setCurrentGroup(IGroupHandle* group);
|
||||||
void selectFirstGroup();
|
void selectFirstGroup();
|
||||||
|
void retranslateUi();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void createGroup(const QString& title, quint32 image, GroupViewItem* group=NULL);
|
void createGroup(const QString& title, quint32 image, GroupViewItem* group=NULL);
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QDateTime>
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
||||||
void initStdRand();
|
void initStdRand();
|
||||||
|
|
|
@ -49,7 +49,6 @@ Import_KWalletXml import_KWalletXml;
|
||||||
Export_Txt export_Txt;
|
Export_Txt export_Txt;
|
||||||
Export_KeePassX_Xml export_KeePassX_Xml;
|
Export_KeePassX_Xml export_KeePassX_Xml;
|
||||||
|
|
||||||
|
|
||||||
KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent, Qt::WFlags flags) :QMainWindow(parent,flags){
|
KeepassMainWindow::KeepassMainWindow(const QString& ArgFile,bool ArgMin,bool ArgLock,QWidget *parent, Qt::WFlags flags) :QMainWindow(parent,flags){
|
||||||
IsLocked=false;
|
IsLocked=false;
|
||||||
EventOccurred=true;
|
EventOccurred=true;
|
||||||
|
@ -191,8 +190,6 @@ void KeepassMainWindow::setupConnections(){
|
||||||
connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook()));
|
connect(HelpHandbookAction,SIGNAL(triggered()),this,SLOT(OnHelpHandbook()));
|
||||||
connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout()));
|
connect(HelpAboutAction,SIGNAL(triggered()),this,SLOT(OnHelpAbout()));
|
||||||
|
|
||||||
connect(EntryView,SIGNAL(itemActivated(QTreeWidgetItem*,int)),EntryView,SLOT(OnEntryActivated(QTreeWidgetItem*,int)));
|
|
||||||
connect(EntryView,SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),EntryView,SLOT(OnEntryDblClicked(QTreeWidgetItem*,int)));
|
|
||||||
connect(QuickSearchEdit,SIGNAL(returnPressed()), this, SLOT(OnQuickSearch()));
|
connect(QuickSearchEdit,SIGNAL(returnPressed()), this, SLOT(OnQuickSearch()));
|
||||||
connect(GroupView,SIGNAL(groupChanged(IGroupHandle*)),EntryView,SLOT(OnGroupChanged(IGroupHandle*)));
|
connect(GroupView,SIGNAL(groupChanged(IGroupHandle*)),EntryView,SLOT(OnGroupChanged(IGroupHandle*)));
|
||||||
connect(GroupView,SIGNAL(groupChanged(IGroupHandle*)),this,SLOT(OnGroupSelectionChanged(IGroupHandle*)));
|
connect(GroupView,SIGNAL(groupChanged(IGroupHandle*)),this,SLOT(OnGroupSelectionChanged(IGroupHandle*)));
|
||||||
|
@ -203,6 +200,8 @@ void KeepassMainWindow::setupConnections(){
|
||||||
connect(GroupView,SIGNAL(searchResultsSelected()),this,SLOT(OnShowSearchResults()));
|
connect(GroupView,SIGNAL(searchResultsSelected()),this,SLOT(OnShowSearchResults()));
|
||||||
connect(GroupView,SIGNAL(entriesDropped()),EntryView,SLOT(removeDragItems()));
|
connect(GroupView,SIGNAL(entriesDropped()),EntryView,SLOT(removeDragItems()));
|
||||||
connect(HideSearchResultsAction,SIGNAL(triggered()),GroupView,SLOT(OnHideSearchResults()));
|
connect(HideSearchResultsAction,SIGNAL(triggered()),GroupView,SLOT(OnHideSearchResults()));
|
||||||
|
connect(EntryView, SIGNAL(viewModeChanged(bool)), SLOT(loadColumnVisibility()));
|
||||||
|
connect(EntryView, SIGNAL(viewModeChanged(bool)), ViewColumnsGroupAction, SLOT(setVisible(bool)));
|
||||||
|
|
||||||
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&)));
|
connect(DetailView,SIGNAL(anchorClicked(const QUrl&)),this,SLOT(OnDetailViewUrlClicked(const QUrl&)));
|
||||||
|
@ -311,17 +310,7 @@ void KeepassMainWindow::setupMenus(){
|
||||||
ViewShowEntryDetailsAction->setChecked(config->showEntryDetails());
|
ViewShowEntryDetailsAction->setChecked(config->showEntryDetails());
|
||||||
ViewHidePasswordsAction->setChecked(config->hidePasswords());
|
ViewHidePasswordsAction->setChecked(config->hidePasswords());
|
||||||
ViewHideUsernamesAction->setChecked(config->hideUsernames());
|
ViewHideUsernamesAction->setChecked(config->hideUsernames());
|
||||||
ViewColumnsTitleAction->setChecked(EntryView->Columns[0]);
|
loadColumnVisibility();
|
||||||
ViewColumnsUsernameAction->setChecked(EntryView->Columns[1]);
|
|
||||||
ViewColumnsUrlAction->setChecked(EntryView->Columns[2]);
|
|
||||||
ViewColumnsPasswordAction->setChecked(EntryView->Columns[3]);
|
|
||||||
ViewColumnsCommentAction->setChecked(EntryView->Columns[4]);
|
|
||||||
ViewColumnsExpireAction->setChecked(EntryView->Columns[5]);
|
|
||||||
ViewColumnsCreationAction->setChecked(EntryView->Columns[6]);
|
|
||||||
ViewColumnsLastChangeAction->setChecked(EntryView->Columns[7]);
|
|
||||||
ViewColumnsLastAccessAction->setChecked(EntryView->Columns[8]);
|
|
||||||
ViewColumnsAttachmentAction->setChecked(EntryView->Columns[9]);
|
|
||||||
ViewColumnsGroupAction->setChecked(EntryView->Columns[10]);
|
|
||||||
ViewShowStatusbarAction->setChecked(config->showStatusbar());
|
ViewShowStatusbarAction->setChecked(config->showStatusbar());
|
||||||
|
|
||||||
switch(config->toolbarIconSize()){
|
switch(config->toolbarIconSize()){
|
||||||
|
@ -385,6 +374,20 @@ void KeepassMainWindow::setupMenus(){
|
||||||
menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
|
menuBookmarks->menuAction()->setVisible(config->featureBookmarks());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeepassMainWindow::loadColumnVisibility() {
|
||||||
|
ViewColumnsTitleAction->setChecked(EntryView->columnVisible(0));
|
||||||
|
ViewColumnsUsernameAction->setChecked(EntryView->columnVisible(1));
|
||||||
|
ViewColumnsUrlAction->setChecked(EntryView->columnVisible(2));
|
||||||
|
ViewColumnsPasswordAction->setChecked(EntryView->columnVisible(3));
|
||||||
|
ViewColumnsCommentAction->setChecked(EntryView->columnVisible(4));
|
||||||
|
ViewColumnsExpireAction->setChecked(EntryView->columnVisible(5));
|
||||||
|
ViewColumnsCreationAction->setChecked(EntryView->columnVisible(6));
|
||||||
|
ViewColumnsLastChangeAction->setChecked(EntryView->columnVisible(7));
|
||||||
|
ViewColumnsLastAccessAction->setChecked(EntryView->columnVisible(8));
|
||||||
|
ViewColumnsAttachmentAction->setChecked(EntryView->columnVisible(9));
|
||||||
|
ViewColumnsGroupAction->setChecked(EntryView->columnVisible(10));
|
||||||
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
|
void KeepassMainWindow::setupDatabaseConnections(IDatabase* DB){
|
||||||
ICustomIcons* CustomIconsDb=dynamic_cast<ICustomIcons*>(DB);
|
ICustomIcons* CustomIconsDb=dynamic_cast<ICustomIcons*>(DB);
|
||||||
if(CustomIconsDb){
|
if(CustomIconsDb){
|
||||||
|
@ -1013,19 +1016,17 @@ void KeepassMainWindow::OnQuickSearch(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnColumnVisibilityChanged(){
|
void KeepassMainWindow::OnColumnVisibilityChanged(){
|
||||||
EntryView->Columns[0]=ViewColumnsTitleAction->isChecked();
|
EntryView->setColumnVisible(0, ViewColumnsTitleAction->isChecked());
|
||||||
EntryView->Columns[1]=ViewColumnsUsernameAction->isChecked();
|
EntryView->setColumnVisible(1, ViewColumnsUsernameAction->isChecked());
|
||||||
EntryView->Columns[2]=ViewColumnsUrlAction->isChecked();
|
EntryView->setColumnVisible(2, ViewColumnsUrlAction->isChecked());
|
||||||
EntryView->Columns[3]=ViewColumnsPasswordAction->isChecked();
|
EntryView->setColumnVisible(3, ViewColumnsPasswordAction->isChecked());
|
||||||
EntryView->Columns[4]=ViewColumnsCommentAction->isChecked();
|
EntryView->setColumnVisible(4, ViewColumnsCommentAction->isChecked());
|
||||||
EntryView->Columns[5]=ViewColumnsExpireAction->isChecked();
|
EntryView->setColumnVisible(5, ViewColumnsExpireAction->isChecked());
|
||||||
EntryView->Columns[6]=ViewColumnsCreationAction->isChecked();
|
EntryView->setColumnVisible(6, ViewColumnsCreationAction->isChecked());
|
||||||
EntryView->Columns[7]=ViewColumnsLastChangeAction->isChecked();
|
EntryView->setColumnVisible(7, ViewColumnsLastChangeAction->isChecked());
|
||||||
EntryView->Columns[8]=ViewColumnsLastAccessAction->isChecked();
|
EntryView->setColumnVisible(8, ViewColumnsLastAccessAction->isChecked());
|
||||||
EntryView->Columns[9]=ViewColumnsAttachmentAction->isChecked();
|
EntryView->setColumnVisible(9, ViewColumnsAttachmentAction->isChecked());
|
||||||
EntryView->Columns[10]=ViewColumnsGroupAction->isChecked();
|
EntryView->setColumnVisible(10, ViewColumnsGroupAction->isVisible() && ViewColumnsGroupAction->isChecked());
|
||||||
EntryView->updateColumns();
|
|
||||||
if(FileOpen) EntryView->refreshItems();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeepassMainWindow::OnUsernPasswVisibilityChanged(){
|
void KeepassMainWindow::OnUsernPasswVisibilityChanged(){
|
||||||
|
@ -1102,7 +1103,8 @@ void KeepassMainWindow::OnExtrasSettings(){
|
||||||
retranslateUi(this);
|
retranslateUi(this);
|
||||||
WorkspaceLockedWidget.retranslateUi(LockedCentralWidget);
|
WorkspaceLockedWidget.retranslateUi(LockedCentralWidget);
|
||||||
ViewShowToolbarAction->setText(tr("Show &Toolbar"));
|
ViewShowToolbarAction->setText(tr("Show &Toolbar"));
|
||||||
EntryView->updateColumns();
|
EntryView->retranslateColumns();
|
||||||
|
GroupView->retranslateUi();
|
||||||
if (FileOpen) {
|
if (FileOpen) {
|
||||||
if (db->file())
|
if (db->file())
|
||||||
setWindowTitle(QString("%1[*] - KeePassX").arg(db->file()->fileName()));
|
setWindowTitle(QString("%1[*] - KeePassX").arg(db->file()->fileName()));
|
||||||
|
|
|
@ -86,6 +86,7 @@ class KeepassMainWindow : public QMainWindow, private Ui_MainWindow{
|
||||||
void OnLockClose();
|
void OnLockClose();
|
||||||
void OnInactivityTimer();
|
void OnInactivityTimer();
|
||||||
void OnShutdown(QSessionManager& manager);
|
void OnShutdown(QSessionManager& manager);
|
||||||
|
void loadColumnVisibility();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent(QCloseEvent* event);
|
void closeEvent(QCloseEvent* event);
|
||||||
|
|
Loading…
Reference in New Issue