Diffstat (limited to 'noncore/apps/qashmoney/budgetdisplay.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-x | noncore/apps/qashmoney/budgetdisplay.cpp | 12 |
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 ) | |||
79 | listview->setColumnAlignment ( 1, Qt::AlignRight ); | 79 | listview->setColumnAlignment ( 1, Qt::AlignRight ); |
80 | listview->setColumnAlignment ( 2, Qt::AlignRight ); | 80 | listview->setColumnAlignment ( 2, Qt::AlignRight ); |
81 | listview->setColumnWidthMode ( 3, QListView::Manual ); | 81 | listview->setColumnWidthMode ( 3, QListView::Manual ); |
82 | 82 | ||
83 | listview->header()->setTracking ( FALSE ); | 83 | listview->header()->setTracking ( FALSE ); |
84 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); | 84 | connect ( listview->header(), SIGNAL ( sizeChange ( int, int, int ) ), this, SLOT ( saveColumnSize ( int, int, int ) ) ); |
85 | connect ( listview->header(), SIGNAL ( clicked ( int ) ), this, SLOT ( saveSortingPreference ( int ) ) ); | ||
86 | |||
87 | // pull the column sorting preference from the preferences table, and configure the listview accordingly | ||
88 | int column = 0; | ||
89 | int direction = 0; | ||
90 | preferences->getSortingPreference ( 3, &column, &direction ); | ||
91 | listview->setSorting ( column, direction ); | ||
85 | 92 | ||
86 | displayBudgetNames(); | 93 | displayBudgetNames(); |
87 | 94 | ||
88 | layout = new QVBoxLayout ( this, 2, 2 ); | 95 | layout = new QVBoxLayout ( this, 2, 2 ); |
89 | layout->setMenuBar ( menu ); | 96 | layout->setMenuBar ( menu ); |
90 | layout->addWidget ( firstline ); | 97 | layout->addWidget ( firstline ); |
@@ -115,12 +122,17 @@ void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) | |||
115 | case 2: | 122 | case 2: |
116 | preferences->changeColumnPreference ( 15, newsize ); | 123 | preferences->changeColumnPreference ( 15, newsize ); |
117 | break; | 124 | break; |
118 | } | 125 | } |
119 | } | 126 | } |
120 | 127 | ||
128 | void BudgetDisplay::saveSortingPreference ( int column ) | ||
129 | { | ||
130 | preferences->changeSortingPreference ( 3, column ); | ||
131 | } | ||
132 | |||
121 | int BudgetDisplay::getIDColumn () | 133 | int BudgetDisplay::getIDColumn () |
122 | { | 134 | { |
123 | int counter; | 135 | int counter; |
124 | int columns = listview->columns(); | 136 | int columns = listview->columns(); |
125 | for ( counter = 0; counter <= columns; counter++ ) | 137 | for ( counter = 0; counter <= columns; counter++ ) |
126 | if ( listview->header()->label ( counter ).length() == 0 ) | 138 | if ( listview->header()->label ( counter ).length() == 0 ) |