summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/budgetdisplay.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/qashmoney/budgetdisplay.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp
index 09f62b2..afc6a2d 100755
--- a/noncore/apps/qashmoney/budgetdisplay.cpp
+++ b/noncore/apps/qashmoney/budgetdisplay.cpp
@@ -79,12 +79,19 @@ BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent )
listview->setColumnAlignment ( 1, Qt::AlignRight );
listview->setColumnAlignment ( 2, Qt::AlignRight );
listview->setColumnWidthMode ( 3, QListView::Manual );
listview->header()->setTracking ( FALSE );
connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) );
+ connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) );
+
+ // pull the column sorting preference from the preferences table, and configure the listview accordingly
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 3, &column, &direction );
+ listview->setSorting ( column, direction );
displayBudgetNames();
layout = new QVBoxLayout ( this, 2, 2 );
layout->setMenuBar ( menu );
layout->addWidget ( firstline );
@@ -115,12 +122,17 @@ void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize )
case 2:
preferences->changeColumnPreference ( 15, newsize );
break;
}
}
+void BudgetDisplay::saveSortingPreference ( int column )
+ {
+ preferences->changeSortingPreference ( 3, column );
+ }
+
int BudgetDisplay::getIDColumn ()
{
int counter;
int columns = listview->columns();
for ( counter = 0; counter <= columns; counter++ )
if ( listview->header()->label ( counter ).length() == 0 )