disconnected QTreeModel sorting method from KeepassEntryView

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@75 b624d157-de02-0410-bad0-e51aec6abb33
master
tariq 19 years ago
parent e281b7c514
commit ab244b187a
  1. 13
      src/lib/EntryView.cpp
  2. 2
      src/lib/EntryView.h

@ -51,6 +51,8 @@ header()->setStretchLastSection(false);
connect(header(),SIGNAL(sectionResized(int,int,int)),this,SLOT(OnColumnResized(int,int,int))); connect(header(),SIGNAL(sectionResized(int,int,int)),this,SLOT(OnColumnResized(int,int,int)));
ContextMenu=new QMenu(this); ContextMenu=new QMenu(this);
setAlternatingRowColors(config.AlternatingRowColors); setAlternatingRowColors(config.AlternatingRowColors);
disconnect(header(),SIGNAL(sectionClicked(int)),this,SLOT(sortByColumn(int)));
//TODO: connect with custom sort function
} }
KeepassEntryView::~KeepassEntryView(){ KeepassEntryView::~KeepassEntryView(){
@ -356,13 +358,14 @@ drag->setPixmap(DragPixmap);
drag->start(); drag->start();
} }
void KeepassEntryView::sortItems(int column,Qt::SortOrder order){};
void KeepassEntryView::paintEvent(QPaintEvent * event){ void KeepassEntryView::paintEvent(QPaintEvent * event){
QTreeWidget::paintEvent(event); QTreeWidget::paintEvent(event);
} }
EntryViewItem::EntryViewItem(QTreeWidget *parent):QTreeWidgetItem(parent){ EntryViewItem::EntryViewItem(QTreeWidget *parent):QTreeWidgetItem(parent){
} }
@ -378,3 +381,11 @@ EntryViewItem::EntryViewItem(QTreeWidgetItem *parent):QTreeWidgetItem(parent){
EntryViewItem::EntryViewItem(QTreeWidgetItem *parent, QTreeWidgetItem *preceding):QTreeWidgetItem(parent,preceding){ EntryViewItem::EntryViewItem(QTreeWidgetItem *parent, QTreeWidgetItem *preceding):QTreeWidgetItem(parent,preceding){
} }
bool EntryViewItem::operator<(EntryViewItem& other){
if(QString::localeAwareCompare( text(treeWidget()->sortColumn()),other.text(treeWidget()->sortColumn())) < 0)
return true;
else
return false;
}

@ -41,6 +41,7 @@ public:
void updateColumns(); void updateColumns();
void refreshItems(); void refreshItems();
void showSearchResults(QList<Q_UINT32>& results); void showSearchResults(QList<Q_UINT32>& results);
virtual void sortItems(int column,Qt::SortOrder order);
Database* db; Database* db;
vector<EntryViewItem*>Items; vector<EntryViewItem*>Items;
QMenu *ContextMenu; QMenu *ContextMenu;
@ -73,6 +74,7 @@ EntryViewItem(QTreeWidget *parent, QTreeWidgetItem * preceding);
EntryViewItem(QTreeWidgetItem *parent); EntryViewItem(QTreeWidgetItem *parent);
EntryViewItem(QTreeWidgetItem *parent, QTreeWidgetItem * preceding); EntryViewItem(QTreeWidgetItem *parent, QTreeWidgetItem * preceding);
CEntry* pEntry; CEntry* pEntry;
virtual bool operator<(EntryViewItem& other);
}; };