summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/budgetdisplay.cpp2
-rwxr-xr-xnoncore/apps/qashmoney/transfer.h4
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/qashmoney/budgetdisplay.cpp b/noncore/apps/qashmoney/budgetdisplay.cpp
index 3fc4e6c..b83eb46 100755
--- a/noncore/apps/qashmoney/budgetdisplay.cpp
+++ b/noncore/apps/qashmoney/budgetdisplay.cpp
@@ -1,131 +1,131 @@
1#include <qmessagebox.h> 1#include <qmessagebox.h>
2#include <qheader.h> 2#include <qheader.h>
3#include <sqlite.h> 3#include <sqlite3.h>
4 4
5#include "budgetdisplay.h" 5#include "budgetdisplay.h"
6#include "budget.h" 6#include "budget.h"
7#include "datepicker.h" 7#include "datepicker.h"
8#include "transaction.h" 8#include "transaction.h"
9 9
10extern Preferences *preferences; 10extern Preferences *preferences;
11extern Budget *budget; 11extern Budget *budget;
12extern Transaction *transaction; 12extern Transaction *transaction;
13 13
14BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent ) 14BudgetDisplay::BudgetDisplay ( QWidget *parent ) : QWidget ( parent )
15 { 15 {
16 QFont font = this->font(); 16 QFont font = this->font();
17 font.setWeight ( QFont::Bold ); 17 font.setWeight ( QFont::Bold );
18 18
19 //set the default date to today 19 //set the default date to today
20 newDate = QDate::currentDate (); 20 newDate = QDate::currentDate ();
21 year = newDate.year(); 21 year = newDate.year();
22 month = newDate.month(); 22 month = newDate.month();
23 day = newDate.day(); 23 day = newDate.day();
24 datelabel = preferences->getDate ( year, month ); 24 datelabel = preferences->getDate ( year, month );
25 25
26 setCaption ( "Budget" ); 26 setCaption ( "Budget" );
27 27
28 firstline = new QHBox ( this ); 28 firstline = new QHBox ( this );
29 firstline->setSpacing ( 2 ); 29 firstline->setSpacing ( 2 );
30 secondline = new QHBox ( this ); 30 secondline = new QHBox ( this );
31 secondline->setSpacing ( 10 ); 31 secondline->setSpacing ( 10 );
32 32
33 menu = new QMenuBar ( this ); 33 menu = new QMenuBar ( this );
34 menu->setFrameStyle ( QFrame::Box | QFrame::Sunken ); 34 menu->setFrameStyle ( QFrame::Box | QFrame::Sunken );
35 budgetmenu = new QPopupMenu ( this ); 35 budgetmenu = new QPopupMenu ( this );
36 lineitemsmenu = new QPopupMenu ( this ); 36 lineitemsmenu = new QPopupMenu ( this );
37 datemenu = new QPopupMenu ( this ); 37 datemenu = new QPopupMenu ( this );
38 menu->insertItem ( "Budget", budgetmenu ); 38 menu->insertItem ( "Budget", budgetmenu );
39 menu->insertItem ( "Line Item", lineitemsmenu ); 39 menu->insertItem ( "Line Item", lineitemsmenu );
40 menu->insertItem ( "Date", datemenu ); 40 menu->insertItem ( "Date", datemenu );
41 budgetmenu->insertItem ( "New", this, SLOT ( newBudget() ), 0, 1 ); 41 budgetmenu->insertItem ( "New", this, SLOT ( newBudget() ), 0, 1 );
42 budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget() ), 0, 2 ); 42 budgetmenu->insertItem ( "Edit", this, SLOT ( editBudget() ), 0, 2 );
43 budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget() ), 0, 3 ); 43 budgetmenu->insertItem ( "Delete", this, SLOT ( deleteBudget() ), 0, 3 );
44 lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem() ), 0, 1 ); 44 lineitemsmenu->insertItem ( "New", this, SLOT ( newLineItem() ), 0, 1 );
45 lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem() ), 0, 2 ); 45 lineitemsmenu->insertItem ( "Edit", this, SLOT ( editLineItem() ), 0, 2 );
46 lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem() ), 0, 3 ); 46 lineitemsmenu->insertItem ( "Delete", this, SLOT ( deleteLineItem() ), 0, 3 );
47 datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) ); 47 datemenu->insertItem ( "Change", this, SLOT ( showCalendar() ) );
48 48
49 budgetbox = new QComboBox ( firstline ); 49 budgetbox = new QComboBox ( firstline );
50 connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) ); 50 connect ( budgetbox, SIGNAL ( activated(int) ), this, SLOT ( setCurrentBudget(int) ) );
51 51
52 budgetview = new QComboBox ( firstline ); 52 budgetview = new QComboBox ( firstline );
53 budgetview->insertItem ( "Month" ); 53 budgetview->insertItem ( "Month" );
54 budgetview->insertItem ( "Year" ); 54 budgetview->insertItem ( "Year" );
55 connect ( budgetview, SIGNAL ( activated(int) ), this, SLOT ( setCurrentView(int) ) ); 55 connect ( budgetview, SIGNAL ( activated(int) ), this, SLOT ( setCurrentView(int) ) );
56 56
57 budgeted = new QLabel ( secondline ); 57 budgeted = new QLabel ( secondline );
58 budgeted->setFont ( font ); 58 budgeted->setFont ( font );
59 actual = new QLabel ( secondline ); 59 actual = new QLabel ( secondline );
60 actual->setFont ( font ); 60 actual->setFont ( font );
61 date = new QLabel ( secondline ); 61 date = new QLabel ( secondline );
62 date->setFont ( font ); 62 date->setFont ( font );
63 63
64 listview = new QListView ( this ); 64 listview = new QListView ( this );
65 listview->setAllColumnsShowFocus ( TRUE ); 65 listview->setAllColumnsShowFocus ( TRUE );
66 listview->setShowSortIndicator ( TRUE ); 66 listview->setShowSortIndicator ( TRUE );
67 listview->setRootIsDecorated ( TRUE ); 67 listview->setRootIsDecorated ( TRUE );
68 listview->setMultiSelection ( FALSE ); 68 listview->setMultiSelection ( FALSE );
69 listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13 69 listview->addColumn ( "Line Item", preferences->getColumnPreference ( 13 ) ); // column id 13
70 listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14 70 listview->addColumn ( "Budget", preferences->getColumnPreference ( 14 ) ); // column id 14
71 listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15 71 listview->addColumn ( "Actual", preferences->getColumnPreference ( 15 ) ); // column id 15
72 listview->addColumn ( "", 0 ); // line item ids 72 listview->addColumn ( "", 0 ); // line item ids
73 listview->setColumnWidthMode ( 0, QListView::Manual ); 73 listview->setColumnWidthMode ( 0, QListView::Manual );
74 listview->setColumnWidthMode ( 1, QListView::Manual ); 74 listview->setColumnWidthMode ( 1, QListView::Manual );
75 listview->setColumnWidthMode ( 2, QListView::Manual ); 75 listview->setColumnWidthMode ( 2, QListView::Manual );
76 listview->setColumnAlignment ( 1, Qt::AlignRight ); 76 listview->setColumnAlignment ( 1, Qt::AlignRight );
77 listview->setColumnAlignment ( 2, Qt::AlignRight ); 77 listview->setColumnAlignment ( 2, Qt::AlignRight );
78 listview->setColumnWidthMode ( 3, QListView::Manual ); 78 listview->setColumnWidthMode ( 3, QListView::Manual );
79 79
80 listview->header()->setTracking ( FALSE ); 80 listview->header()->setTracking ( FALSE );
81 connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) ); 81 connect ( listview->header(), SIGNAL ( sizeChange(int,int,int) ), this, SLOT ( saveColumnSize(int,int,int) ) );
82 connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) ); 82 connect ( listview->header(), SIGNAL ( clicked(int) ), this, SLOT ( saveSortingPreference(int) ) );
83 83
84 // pull the column sorting preference from the preferences table, and configure the listview accordingly 84 // pull the column sorting preference from the preferences table, and configure the listview accordingly
85 int column = 0; 85 int column = 0;
86 int direction = 0; 86 int direction = 0;
87 preferences->getSortingPreference ( 3, &column, &direction ); 87 preferences->getSortingPreference ( 3, &column, &direction );
88 listview->setSorting ( column, direction ); 88 listview->setSorting ( column, direction );
89 89
90 displayBudgetNames(); 90 displayBudgetNames();
91 91
92 layout = new QVBoxLayout ( this, 2, 2 ); 92 layout = new QVBoxLayout ( this, 2, 2 );
93 layout->setMenuBar ( menu ); 93 layout->setMenuBar ( menu );
94 layout->addWidget ( firstline ); 94 layout->addWidget ( firstline );
95 layout->addWidget ( secondline ); 95 layout->addWidget ( secondline );
96 layout->addWidget ( listview ); 96 layout->addWidget ( listview );
97 } 97 }
98 98
99void BudgetDisplay::deleteBudget () 99void BudgetDisplay::deleteBudget ()
100 { 100 {
101 listview->clear(); 101 listview->clear();
102 transaction->clearBudgetIDs ( currentbudget ); 102 transaction->clearBudgetIDs ( currentbudget );
103 budget->deleteBudget ( currentbudget ); 103 budget->deleteBudget ( currentbudget );
104 if ( budgetbox->count() != 0 ) 104 if ( budgetbox->count() != 0 )
105 displayBudgetNames(); 105 displayBudgetNames();
106 checkBudgets(); 106 checkBudgets();
107 } 107 }
108 108
109void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize ) 109void BudgetDisplay::saveColumnSize ( int column, int oldsize, int newsize )
110 { 110 {
111 switch ( column ) 111 switch ( column )
112 { 112 {
113 case 0: 113 case 0:
114 preferences->changeColumnPreference ( 13, newsize ); 114 preferences->changeColumnPreference ( 13, newsize );
115 break; 115 break;
116 case 1: 116 case 1:
117 preferences->changeColumnPreference ( 14, newsize ); 117 preferences->changeColumnPreference ( 14, newsize );
118 break; 118 break;
119 case 2: 119 case 2:
120 preferences->changeColumnPreference ( 15, newsize ); 120 preferences->changeColumnPreference ( 15, newsize );
121 break; 121 break;
122 } 122 }
123 } 123 }
124 124
125void BudgetDisplay::saveSortingPreference ( int column ) 125void BudgetDisplay::saveSortingPreference ( int column )
126 { 126 {
127 preferences->changeSortingPreference ( 3, column ); 127 preferences->changeSortingPreference ( 3, column );
128 } 128 }
129 129
130int BudgetDisplay::getIDColumn () 130int BudgetDisplay::getIDColumn ()
131 { 131 {
diff --git a/noncore/apps/qashmoney/transfer.h b/noncore/apps/qashmoney/transfer.h
index e910e7c..cec3386 100755
--- a/noncore/apps/qashmoney/transfer.h
+++ b/noncore/apps/qashmoney/transfer.h
@@ -1,52 +1,52 @@
1#ifndef TRANSFER_H 1#ifndef TRANSFER_H
2#define TRANSFER_H 2#define TRANSFER_H
3 3
4#include <qlistview.h> 4#include <qlistview.h>
5#include <qstring.h> 5#include <qstring.h>
6#include <sqlite.h> 6#include <sqlite3.h>
7#include <qdatetime.h> 7#include <qdatetime.h>
8 8
9#include "preferences.h" 9#include "preferences.h"
10 10
11class Transfer 11class Transfer
12 { 12 {
13 public: 13 public:
14 14
15 Transfer (); 15 Transfer ();
16 ~Transfer (); 16 ~Transfer ();
17 17
18 // This function adds a new transfer to the database. It takes the fromaccount, toaccount, 18 // This function adds a new transfer to the database. It takes the fromaccount, toaccount,
19 // number, frombudget, tobudget, day, month, year, amount, cleared 19 // number, frombudget, tobudget, day, month, year, amount, cleared
20 void addTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared ); 20 void addTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared );
21 void updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid ); 21 void updateTransfer ( int fromaccount, int fromparent, int toaccount, int toparent, int day, int month, int year, float amount, int cleared, int transferid );
22 22
23 // Deletes a transfer. Takes the transferid as its parameter 23 // Deletes a transfer. Takes the transferid as its parameter
24 void deleteTransfer ( int ); 24 void deleteTransfer ( int );
25 25
26 // Deletes all transfers for a given accountid 26 // Deletes all transfers for a given accountid
27 void deleteAllTransfers ( int accountid ); 27 void deleteAllTransfers ( int accountid );
28 28
29 // Returns the number of checking transfers 29 // Returns the number of checking transfers
30 int getNumberOfTransfers (); 30 int getNumberOfTransfers ();
31 int getNumberOfTransfers ( int accountid ); 31 int getNumberOfTransfers ( int accountid );
32 32
33 void displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate ); 33 void displayTransfers ( QListView *listview, int accountid, bool children, QDate displaydate );
34 int getCleared ( int id ); 34 int getCleared ( int id );
35 void setCleared ( int id, int cleared ); 35 void setCleared ( int id, int cleared );
36 int getFromAccountID ( int id ); 36 int getFromAccountID ( int id );
37 int getToAccountID ( int id ); 37 int getToAccountID ( int id );
38 38
39 int getDay ( int id ); 39 int getDay ( int id );
40 int getMonth ( int id ); 40 int getMonth ( int id );
41 int getYear ( int id ); 41 int getYear ( int id );
42 QString getAmount ( int id ); 42 QString getAmount ( int id );
43 43
44 private: 44 private:
45 45
46 sqlite *db; 46 sqlite3 *db;
47 }; 47 };
48 48
49#endif 49#endif
50 50
51 51
52 52