summaryrefslogtreecommitdiff
path: root/noncore/apps/qashmoney/qashmoney.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/qashmoney/qashmoney.cpp') (more/less context) (show whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/qashmoney.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/noncore/apps/qashmoney/qashmoney.cpp b/noncore/apps/qashmoney/qashmoney.cpp
index 83eea01..20e8d32 100755
--- a/noncore/apps/qashmoney/qashmoney.cpp
+++ b/noncore/apps/qashmoney/qashmoney.cpp
@@ -7,24 +7,25 @@
Budget *budget = new Budget ();
Preferences *preferences = new Preferences ();
Account *account = new Account ();
Transaction *transaction = new Transaction ();
Transfer *transfer = new Transfer ();
Memory *memory = new Memory ();
QashMoney::QashMoney () : QWidget ()
{
preferences->addPreferences();
preferences->initializeColumnPreferences ();
+ preferences->initializeSortingPreferences ();
// set the text in the upper part of the frame
setCaption ( tr ( "QashMoney" ) );
// Create new menubar for our mainwindow
// and add menu items
mainmenu = new QPEMenuBar ( this );
mainmenu->setFrameStyle ( QFrame::PopupPanel | QFrame::Raised );
preferencesmenu = new QPopupMenu ( this );
utilitiesmenu = new QPopupMenu ( this );
mainmenu->insertItem ( "Preferences", preferencesmenu );
mainmenu->insertItem ( "Utilities", utilitiesmenu );
@@ -144,25 +145,25 @@ void QashMoney::changeTabDisplay ()
transactiondisplay->setAccountID ( accountid );
setTransactionDisplayDate ();
// display transactions
transactiondisplay->listview->clear();
QString displaytext = "%";
displaytext.prepend ( transactiondisplay->limitbox->text() );
if ( transaction->getNumberOfTransactions() > 0 )
transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate );
// display transfers
- transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
+ transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
// open a new preferences object and resize the transaction display columns
// each column will have a different size based on whether we are looking at a child
// account or children through a parent
if ( parentaccountid != -1 || accountdisplay->listview->selectedItem()->childCount() == 0 ) // a parent with no children or a child - three columns
{
transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 3 ) ); // normal transaction date width
transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 4 ) ); // normal transaction name width
transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 5 ) ); // normal transaction amount width
transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual );
@@ -170,42 +171,54 @@ void QashMoney::changeTabDisplay ()
else
{
transactiondisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 6 ) ); // extended transaction date width
transactiondisplay->listview->setColumnWidthMode ( 0, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 7 ) ); // extended transaction name width
transactiondisplay->listview->setColumnWidthMode ( 1, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 2, preferences->getColumnPreference ( 8 ) ); // extended transaction amount width
transactiondisplay->listview->setColumnWidthMode ( 2, QListView::Manual );
transactiondisplay->listview->setColumnWidth ( 4, preferences->getColumnPreference ( 9 ) ); // transaction account width
transactiondisplay->listview->setColumnWidthMode ( 4, QListView::Manual );
}
+ // pull the column sorting preference from the preferences table, and configure the listview accordingly
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 2, &column, &direction );
+ transactiondisplay->listview->setSorting ( column, direction );
+
// show the window
transactiondisplay->show();
// hide the account display and define accountid
accountdisplay->hide();
// hide the budget display
budgetdisplay->hide();
}
else if ( maintabs->currentPageIndex() == 0 )
{
disableOneTouchViewing();
// clear the account display selection
accountdisplay->listview->clearSelection();
// resize the account display columns
accountdisplay->listview->setColumnWidth ( 0, preferences->getColumnPreference ( 1 ) );
accountdisplay->listview->setColumnWidth ( 1, preferences->getColumnPreference ( 2 ) );
+ // set sorting preference on account display columns
+ int column = 0;
+ int direction = 0;
+ preferences->getSortingPreference ( 1, &column, &direction );
+ accountdisplay->listview->setSorting ( column, direction );
+
// display the accounts
if ( account->getNumberOfAccounts() != 0 )
account->displayAccounts ( accountdisplay->listview );
maintabs->setTabEnabled ( tab_2, FALSE );
// set the toggle button
accountdisplay->setToggleButton ();
// show the account display
accountdisplay->show();
// hide the transaction display
@@ -253,25 +266,25 @@ void QashMoney::displayDatePreferencesDialog ()
// redisplay transactions if they are visible incorporating
// any changes to the date format
transactiondisplay->listview->clear();
QString displaytext = "%";
displaytext.prepend ( transactiondisplay->limitbox->text() );
setTransactionDisplayDate();
if ( transaction->getNumberOfTransactions() > 0 )
transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate );
if ( transfer->getNumberOfTransfers() != 0 )
- transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
+ transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
}
else if ( accountdisplay->isVisible() )
{
accountdisplay->listview->clearSelection();
maintabs->setTabEnabled ( tab_2, FALSE );
}
else
budgetdisplay->updateBudgetInformation();
}
void QashMoney::displayTransactionPreferencesDialog ()
{
@@ -291,25 +304,25 @@ void QashMoney::displayTransactionPreferencesDialog ()
children = FALSE;
// redisplay transactions incorporating any transaction preference changes
transactiondisplay->listview->clear();
QString displaytext = "%";
displaytext.prepend ( transactiondisplay->limitbox->text() );
setTransactionDisplayDate();
if ( transaction->getNumberOfTransactions() > 0 )
transaction->displayTransactions ( transactiondisplay->listview, accountid, children, displaytext, newdate );
if ( transfer->getNumberOfTransfers() != 0 )
- transfer->displayTransfers ( transactiondisplay->listview, accountid, children );
+ transfer->displayTransfers ( transactiondisplay->listview, accountid, children, newdate );
}
else
{
accountdisplay->listview->clearSelection();
maintabs->setTabEnabled ( tab_2, FALSE );
}
}
void QashMoney::displayAccountPreferencesDialog ()
{
// display a dialog for setting preferences for accounts
AccountPreferences *ap = new AccountPreferences ( this );
@@ -376,15 +389,15 @@ void QashMoney::setTransactionDisplayDate ()
case 2: // three months
newdate = today.addDays ( -90 );
break;
case 3: // six months
newdate = today.addDays ( -180 );
break;
case 4: // one year
newdate = today.addDays ( -365 );
break;
}
}
else
- newdate = QDate ( 1, 1, 1000 );
+ newdate = QDate ( 1900, 1, 1 );
}