summaryrefslogtreecommitdiff
authorallenforsythe <allenforsythe>2003-05-15 10:54:55 (UTC)
committer allenforsythe <allenforsythe>2003-05-15 10:54:55 (UTC)
commit2e756a3677b9d4ef426f06beab7ba595c9878f4a (patch) (unidiff)
tree0776c1d88c1188bb0ee3e84fc5115980275b26df
parent19be94085643ce40e35a58eb419eb6b51a02b8d1 (diff)
downloadopie-2e756a3677b9d4ef426f06beab7ba595c9878f4a.zip
opie-2e756a3677b9d4ef426f06beab7ba595c9878f4a.tar.gz
opie-2e756a3677b9d4ef426f06beab7ba595c9878f4a.tar.bz2
Added limit transaction combobox to transaction prefs
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/apps/qashmoney/preferencedialogs.cpp23
-rwxr-xr-xnoncore/apps/qashmoney/preferencedialogs.h6
-rwxr-xr-xnoncore/apps/qashmoney/preferences.cpp8
3 files changed, 34 insertions, 3 deletions
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp
index 3c2fb97..00d52c6 100755
--- a/noncore/apps/qashmoney/preferencedialogs.cpp
+++ b/noncore/apps/qashmoney/preferencedialogs.cpp
@@ -66,80 +66,101 @@ void DatePreferences::setDefaultDatePreferences ()
66 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 ); 66 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
67 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 ); 67 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
68 } 68 }
69 69
70// START TRANSACTION PREFERENCES 70// START TRANSACTION PREFERENCES
71 71
72TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 72TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
73{ 73{
74 setCaption( tr ( "Transaction" ) ); 74 setCaption( tr ( "Transaction" ) );
75 75
76 showclearedtransactions = new QCheckBox ( this ); 76 showclearedtransactions = new QCheckBox ( this );
77 showclearedtransactions->setText ( "Show Cleared Transactions" ); 77 showclearedtransactions->setText ( "Show Cleared Transactions" );
78 78
79 excludetransfers = new QCheckBox ( this ); 79 excludetransfers = new QCheckBox ( this );
80 excludetransfers->setText ( "Include Transfers In Limit View" ); 80 excludetransfers->setText ( "Include Transfers In Limit View" );
81 81
82 limittransactionsbox = new QHBox ( this );
83 limittransactionsbox->setSpacing ( 2 );
84 limittransactionslabel = new QLabel ( "Limit All Transactions To", limittransactionsbox );
85 limittransactions = new QComboBox ( limittransactionsbox );
86 limittransactions->insertItem ( "14 days" );
87 limittransactions->insertItem ( "30 days" );
88 limittransactions->insertItem ( "60 days" );
89 limittransactions->insertItem ( "90 days" );
90 limittransactions->insertItem ( "180 days" );
91 limittransactions->insertItem ( "365 days" );
92 limittransactions->insertItem ( "All" );
93
82 if ( preferences->getPreference ( 3 ) == 1 ) 94 if ( preferences->getPreference ( 3 ) == 1 )
83 showclearedtransactions->setChecked ( TRUE ); 95 showclearedtransactions->setChecked ( TRUE );
84 else 96 else
85 showclearedtransactions->setChecked ( FALSE ); 97 showclearedtransactions->setChecked ( FALSE );
86 98
87 if ( preferences->getPreference ( 6 ) == 1 ) 99 if ( preferences->getPreference ( 6 ) == 1 )
88 excludetransfers->setChecked ( TRUE ); 100 excludetransfers->setChecked ( TRUE );
89 else 101 else
90 excludetransfers->setChecked ( FALSE ); 102 excludetransfers->setChecked ( FALSE );
91 103
92 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); 104 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
93 connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); 105 connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) );
94 106
95 layout = new QVBoxLayout ( this, 2, 2 ); 107 layout = new QVBoxLayout ( this, 2, 2 );
96 layout->addWidget ( showclearedtransactions ); 108 layout->addWidget ( showclearedtransactions );
97 layout->addWidget ( excludetransfers ); 109 layout->addWidget ( excludetransfers );
98 layout->insertSpacing ( 2, 5 ); 110 layout->addWidget ( limittransactionsbox );
111 layout->insertSpacing ( 3, 5 );
99 layout->addWidget ( defaults ); 112 layout->addWidget ( defaults );
100 113
101 connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); 114 connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) );
102 connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); 115 connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) );
116 connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) );
103} 117}
104 118
105TransactionPreferences::~TransactionPreferences () 119TransactionPreferences::~TransactionPreferences ()
106 { 120 {
107 } 121 }
108 122
123void TransactionPreferences::changeLimitTransactionsPreference ( int pref )
124 {
125 preferences->changePreference ( 7, pref );
126 }
127
109void TransactionPreferences::changeShowClearedPreference ( bool state ) 128void TransactionPreferences::changeShowClearedPreference ( bool state )
110 { 129 {
111 if ( state == TRUE ) 130 if ( state == TRUE )
112 preferences->changePreference ( 3, 1 ); 131 preferences->changePreference ( 3, 1 );
113 else 132 else
114 preferences->changePreference ( 3, 0 ); 133 preferences->changePreference ( 3, 0 );
115 } 134 }
116 135
117void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) 136void TransactionPreferences::changeExcludeTranfersPreference ( bool state )
118 { 137 {
119 if ( state == TRUE ) 138 if ( state == TRUE )
120 preferences->changePreference ( 6, 1 ); 139 preferences->changePreference ( 6, 1 );
121 else 140 else
122 preferences->changePreference ( 6, 0 ); 141 preferences->changePreference ( 6, 0 );
123 } 142 }
124 143
125void TransactionPreferences::setDefaultTransactionPreferences () 144void TransactionPreferences::setDefaultTransactionPreferences ()
126 { 145 {
127 preferences->changePreference ( 3, 0 ); 146 preferences->changePreference ( 3, 0 );
128 preferences->changePreference ( 6, 0 ); 147 preferences->changePreference ( 6, 0 );
148 preferences->changePreference ( 7, 0 );
129 showclearedtransactions->setChecked ( FALSE ); 149 showclearedtransactions->setChecked ( FALSE );
150 limittransactions->setCurrentItem ( 0 );
130 } 151 }
131 152
132// START ACCOUNT PREFERNCES 153// START ACCOUNT PREFERNCES
133 154
134AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) 155AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
135{ 156{
136 157
137 setCaption( tr ( "Account" ) ); 158 setCaption( tr ( "Account" ) );
138 159
139 currencysupport = new QCheckBox ( this ); 160 currencysupport = new QCheckBox ( this );
140 currencysupport->setText ( "Enable Currency Support" ); 161 currencysupport->setText ( "Enable Currency Support" );
141 162
142 onetouch = new QCheckBox ( this ); 163 onetouch = new QCheckBox ( this );
143 onetouch->setText ( "One Touch Account Viewing" ); 164 onetouch->setText ( "One Touch Account Viewing" );
144 165
145 if ( preferences->getPreference ( 4 ) == 1 ) 166 if ( preferences->getPreference ( 4 ) == 1 )
diff --git a/noncore/apps/qashmoney/preferencedialogs.h b/noncore/apps/qashmoney/preferencedialogs.h
index 97b2dbb..88281b8 100755
--- a/noncore/apps/qashmoney/preferencedialogs.h
+++ b/noncore/apps/qashmoney/preferencedialogs.h
@@ -1,24 +1,26 @@
1#include <qcombobox.h> 1#include <qcombobox.h>
2#include <qdialog.h> 2#include <qdialog.h>
3#include <qpushbutton.h> 3#include <qpushbutton.h>
4#include <qpixmap.h> 4#include <qpixmap.h>
5#include <qgroupbox.h> 5#include <qgroupbox.h>
6#include <qhbuttongroup.h> 6#include <qhbuttongroup.h>
7#include <qcheckbox.h> 7#include <qcheckbox.h>
8#include <qlayout.h> 8#include <qlayout.h>
9#include <qlabel.h>
10#include <qhbox.h>
9 11
10#ifndef DATEPREFERENCES_H 12#ifndef DATEPREFERENCES_H
11#define DATEPREFERENCES_H 13#define DATEPREFERENCES_H
12 14
13class DatePreferences : public QDialog 15class DatePreferences : public QDialog
14 { 16 {
15 Q_OBJECT 17 Q_OBJECT
16 18
17 public: 19 public:
18 DatePreferences ( QWidget * parent ); 20 DatePreferences ( QWidget * parent );
19 ~DatePreferences(); 21 ~DatePreferences();
20 22
21 QPushButton *defaults; 23 QPushButton *defaults;
22 QComboBox *dateformat; 24 QComboBox *dateformat;
23 QComboBox *dateseparator; 25 QComboBox *dateseparator;
24 QBoxLayout *layout; 26 QBoxLayout *layout;
@@ -31,41 +33,43 @@ class DatePreferences : public QDialog
31 33
32#endif 34#endif
33 35
34#ifndef TRANSACTIONPREFERENCES_H 36#ifndef TRANSACTIONPREFERENCES_H
35#define TRANSACTIONPREFERENCES_H 37#define TRANSACTIONPREFERENCES_H
36 38
37class TransactionPreferences : public QDialog 39class TransactionPreferences : public QDialog
38 { 40 {
39 Q_OBJECT 41 Q_OBJECT
40 42
41 public: 43 public:
42 TransactionPreferences ( QWidget * parent ); 44 TransactionPreferences ( QWidget * parent );
43 ~TransactionPreferences(); 45 ~TransactionPreferences();
44 46
45 QCheckBox *showclearedtransactions; 47 QCheckBox *showclearedtransactions;
46 QCheckBox *excludetransfers; 48 QCheckBox *excludetransfers;
47 QString *limittransactionslabel; 49 QHBox *limittransactionsbox;
50 QLabel *limittransactionslabel;
48 QComboBox *limittransactions; 51 QComboBox *limittransactions;
49 QPushButton *defaults; 52 QPushButton *defaults;
50 QBoxLayout *layout; 53 QBoxLayout *layout;
51 54
52 public slots: 55 public slots:
53 void changeShowClearedPreference ( bool ); 56 void changeShowClearedPreference ( bool );
54 void changeExcludeTranfersPreference ( bool ); 57 void changeExcludeTranfersPreference ( bool );
55 void setDefaultTransactionPreferences (); 58 void setDefaultTransactionPreferences ();
59 void changeLimitTransactionsPreference ( int );
56}; 60};
57 61
58#endif 62#endif
59 63
60#ifndef ACCOUNTPREFERENCES_H 64#ifndef ACCOUNTPREFERENCES_H
61#define ACCOUNTPREFERENCES_H 65#define ACCOUNTPREFERENCES_H
62 66
63class AccountPreferences : public QDialog 67class AccountPreferences : public QDialog
64 { 68 {
65 Q_OBJECT 69 Q_OBJECT
66 70
67 public: 71 public:
68 AccountPreferences ( QWidget * parent ); 72 AccountPreferences ( QWidget * parent );
69 ~AccountPreferences(); 73 ~AccountPreferences();
70 74
71 QCheckBox *currencysupport; 75 QCheckBox *currencysupport;
diff --git a/noncore/apps/qashmoney/preferences.cpp b/noncore/apps/qashmoney/preferences.cpp
index 8783a47..819d5cf 100755
--- a/noncore/apps/qashmoney/preferences.cpp
+++ b/noncore/apps/qashmoney/preferences.cpp
@@ -9,33 +9,33 @@ Preferences::Preferences ()
9Preferences::~Preferences () 9Preferences::~Preferences ()
10 { 10 {
11 sqlite_close ( db ); 11 sqlite_close ( db );
12 } 12 }
13 13
14void Preferences::addPreferences () 14void Preferences::addPreferences ()
15 { 15 {
16 // This function checks the preferences database for existing preferences and adds 16 // This function checks the preferences database for existing preferences and adds
17 // them if they are not there. First we set up variables. Preferences are always set 17 // them if they are not there. First we set up variables. Preferences are always set
18 // to non-zero numbers because when we check to see if a preference has been 18 // to non-zero numbers because when we check to see if a preference has been
19 // added to the database, the result is zero if it hasn't 19 // added to the database, the result is zero if it hasn't
20 int rows = 0; 20 int rows = 0;
21 int columns = 0; 21 int columns = 0;
22 char **results; 22 char **results;
23 23
24 sqlite_get_table ( db, "select count() from preferences;", &results, 0, 0, 0 ); 24 sqlite_get_table ( db, "select count() from preferences;", &results, 0, 0, 0 );
25 if ( atoi ( results [ 1 ] ) != 6 ) 25 if ( atoi ( results [ 1 ] ) != 7 )
26 { 26 {
27 // dateformat preference 1 = yyyymmdd 2 = yymmdd 3 = mmddyyyy 4 = mmddyy 27 // dateformat preference 1 = yyyymmdd 2 = yymmdd 3 = mmddyyyy 4 = mmddyy
28 // 5 = yyyyddmm 6 = yyddmm 7 = ddmmyyyy 8 = ddmmyy 28 // 5 = yyyyddmm 6 = yyddmm 7 = ddmmyyyy 8 = ddmmyy
29 sqlite_get_table ( db, "select preference from preferences where id = 1;", &results, &rows, &columns, 0 ); 29 sqlite_get_table ( db, "select preference from preferences where id = 1;", &results, &rows, &columns, 0 );
30 if ( rows == 0 ) 30 if ( rows == 0 )
31 sqlite_exec ( db, "insert into preferences values ( 4, 'dateformat', 0, 0, 0, NULL );", 0, 0, 0 ); 31 sqlite_exec ( db, "insert into preferences values ( 4, 'dateformat', 0, 0, 0, NULL );", 0, 0, 0 );
32 32
33 // dateseparator preference 1 = / ( forward slash ) 2 = - ( dash ) 3 = . ( period ) 33 // dateseparator preference 1 = / ( forward slash ) 2 = - ( dash ) 3 = . ( period )
34 rows = 0; 34 rows = 0;
35 sqlite_get_table ( db, "select preference from preferences where id = 2;", &results, &rows, &columns, 0 ); 35 sqlite_get_table ( db, "select preference from preferences where id = 2;", &results, &rows, &columns, 0 );
36 if ( rows == 0 ) 36 if ( rows == 0 )
37 sqlite_exec ( db, "insert into preferences values ( 1, 'dateseparator', 0, 0, 0, NULL );", 0, 0, 0 ); 37 sqlite_exec ( db, "insert into preferences values ( 1, 'dateseparator', 0, 0, 0, NULL );", 0, 0, 0 );
38 38
39 // showclearedtransactions preference 0 = no 1 = yes 39 // showclearedtransactions preference 0 = no 1 = yes
40 rows = 0; 40 rows = 0;
41 sqlite_get_table ( db, "select preference from preferences where id = 3;", &results, &rows, &columns, 0 ); 41 sqlite_get_table ( db, "select preference from preferences where id = 3;", &results, &rows, &columns, 0 );
@@ -46,32 +46,38 @@ void Preferences::addPreferences ()
46 rows = 0; 46 rows = 0;
47 sqlite_get_table ( db, "select preference from preferences where id = 4;", &results, &rows, &columns, 0 ); 47 sqlite_get_table ( db, "select preference from preferences where id = 4;", &results, &rows, &columns, 0 );
48 if ( rows == 0 ) 48 if ( rows == 0 )
49 sqlite_exec ( db, "insert into preferences values ( 0, 'enablecurrencysupport', 0, 0, 0, NULL );", 0, 0, 0 ); 49 sqlite_exec ( db, "insert into preferences values ( 0, 'enablecurrencysupport', 0, 0, 0, NULL );", 0, 0, 0 );
50 50
51 // one touch account viewing preference 0 = no 1 = yes 51 // one touch account viewing preference 0 = no 1 = yes
52 rows = 0; 52 rows = 0;
53 sqlite_get_table ( db, "select preference from preferences where id = 5;", &results, &rows, &columns, 0 ); 53 sqlite_get_table ( db, "select preference from preferences where id = 5;", &results, &rows, &columns, 0 );
54 if ( rows == 0 ) 54 if ( rows == 0 )
55 sqlite_exec ( db, "insert into preferences values ( 0, 'onetouchviewing', 0, 0, 0, NULL );", 0, 0, 0 ); 55 sqlite_exec ( db, "insert into preferences values ( 0, 'onetouchviewing', 0, 0, 0, NULL );", 0, 0, 0 );
56 56
57 // exclude transfers from limit view 0 = no 1 = yes 57 // exclude transfers from limit view 0 = no 1 = yes
58 rows = 0; 58 rows = 0;
59 sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); 59 sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 );
60 if ( rows == 0 ) 60 if ( rows == 0 )
61 sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); 61 sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 );
62
63 // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 60 days, 3 = 90 days, 4 = 180 days, 5 = 365 days, 6 = all
64 rows = 0;
65 sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 );
66 if ( rows == 0 )
67 sqlite_exec ( db, "insert into preferences values ( 0, 'limittransactions', 0, 0, 0, NULL );", 0, 0, 0 );
62 } 68 }
63 } 69 }
64 70
65void Preferences::initializeColumnPreferences () 71void Preferences::initializeColumnPreferences ()
66 { 72 {
67 int rows = 0; 73 int rows = 0;
68 int columns = 0; 74 int columns = 0;
69 char **results; 75 char **results;
70 76
71 // initialize accountname column width 77 // initialize accountname column width
72 sqlite_get_table ( db, "select width from columns where id = 1;", &results, &rows, &columns, 0 ); 78 sqlite_get_table ( db, "select width from columns where id = 1;", &results, &rows, &columns, 0 );
73 if ( rows == 0 ) 79 if ( rows == 0 )
74 sqlite_exec ( db, "insert into columns values ( 'accountname', 90, 0, 0, 0, NULL );", 0, 0, 0 ); 80 sqlite_exec ( db, "insert into columns values ( 'accountname', 90, 0, 0, 0, NULL );", 0, 0, 0 );
75 81
76 // initialize accountbalance column width 82 // initialize accountbalance column width
77 sqlite_get_table ( db, "select width from columns where id = 2;", &results, &rows, &columns, 0 ); 83 sqlite_get_table ( db, "select width from columns where id = 2;", &results, &rows, &columns, 0 );