00001 #include "preferencedialogs.h"
00002 #include "preferences.h"
00003
00004 extern Preferences *preferences;
00005
00006 DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
00007 {
00008 setCaption( tr( "Date" ) );
00009
00010 QLabel *datelabel = new QLabel ( "Format", this );
00011 dateformat = new QComboBox ( this );
00012 dateformat->setEditable ( FALSE );
00013 dateformat->insertItem ( "yyyymmdd" );
00014 dateformat->insertItem ( "yymmdd" );
00015 dateformat->insertItem ( "mmddyyyy" );
00016 dateformat->insertItem ( "mmddyy" );
00017 dateformat->insertItem ( "yyyyddmm" );
00018 dateformat->insertItem ( "yyddmm" );
00019 dateformat->insertItem ( "ddmmyyyy" );
00020 dateformat->insertItem ( "ddmmyy" );
00021 connect ( dateformat, SIGNAL ( activated(int) ), this, SLOT ( changeDateFormat(int) ) );
00022
00023 QLabel *dateseparatorlabel = new QLabel ( "Separator", this );
00024 dateseparator = new QComboBox ( this );
00025 dateseparator->insertItem ( "/" );
00026 dateseparator->insertItem ( "-" );
00027 dateseparator->insertItem ( "." );
00028 connect ( dateseparator, SIGNAL ( activated(int) ), this, SLOT ( changeDateSeparator(int) ) );
00029
00030 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
00031 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultDatePreferences() ) );
00032
00033 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
00034 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
00035
00036 layout = new QVBoxLayout ( this, 2, 2 );
00037 layout->addWidget ( datelabel );
00038 layout->addWidget ( dateformat );
00039 layout->addWidget ( dateseparatorlabel );
00040 layout->addWidget ( dateseparator );
00041 layout->insertSpacing ( 4, 5 );
00042 layout->addWidget ( defaults );
00043
00044 }
00045
00046 DatePreferences::~DatePreferences ()
00047 {
00048 }
00049
00050 void DatePreferences::changeDateFormat ( int index )
00051 {
00052 index ++;
00053 preferences->changePreference ( 1, index );
00054 }
00055
00056 void DatePreferences::changeDateSeparator ( int index )
00057 {
00058 index ++;
00059 preferences->changePreference ( 2, index );
00060 }
00061
00062 void DatePreferences::setDefaultDatePreferences ()
00063 {
00064 preferences->setDefaultDatePreferences ();
00065 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
00066 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
00067 }
00068
00069
00070
00071 TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
00072 {
00073 setCaption( tr ( "Transaction" ) );
00074
00075 showclearedtransactions = new QCheckBox ( this );
00076 showclearedtransactions->setText ( "Show Cleared Transactions" );
00077
00078 limittransactionsbox = new QHBox ( this );
00079 limittransactionsbox->setSpacing ( 2 );
00080 limittransactionslabel = new QLabel ( "Show ", limittransactionsbox );
00081 limittransactions = new QComboBox ( limittransactionsbox );
00082 QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox );
00083 limittransactions->insertItem ( "14 days" );
00084 limittransactions->insertItem ( "30 days" );
00085 limittransactions->insertItem ( "90 days" );
00086 limittransactions->insertItem ( "180 days" );
00087 limittransactions->insertItem ( "365 days" );
00088 limittransactions->insertItem ( "All" );
00089 limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) );
00090
00091 excludetransfers = new QCheckBox ( this );
00092 excludetransfers->setText ( "Include Transfers In Limit View" );
00093
00094 if ( preferences->getPreference ( 3 ) == 1 )
00095 showclearedtransactions->setChecked ( TRUE );
00096 else
00097 showclearedtransactions->setChecked ( FALSE );
00098
00099 if ( preferences->getPreference ( 6 ) == 1 )
00100 excludetransfers->setChecked ( TRUE );
00101 else
00102 excludetransfers->setChecked ( FALSE );
00103
00104 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
00105 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultTransactionPreferences() ) );
00106
00107 layout = new QVBoxLayout ( this, 2, 2 );
00108 layout->addWidget ( showclearedtransactions );
00109 layout->addWidget ( limittransactionsbox );
00110 layout->addWidget ( excludetransfers );
00111 layout->insertSpacing ( 3, 5 );
00112 layout->addWidget ( defaults );
00113
00114 connect ( showclearedtransactions, SIGNAL ( toggled(bool) ), this, SLOT ( changeShowClearedPreference(bool) ) );
00115 connect ( excludetransfers, SIGNAL ( toggled(bool) ), this, SLOT ( changeExcludeTranfersPreference(bool) ) );
00116 connect ( limittransactions, SIGNAL ( activated(int) ), this, SLOT ( changeLimitTransactionsPreference(int) ) );
00117 }
00118
00119 TransactionPreferences::~TransactionPreferences ()
00120 {
00121 }
00122
00123 void TransactionPreferences::changeLimitTransactionsPreference ( int pref )
00124 {
00125 preferences->changePreference ( 7, pref );
00126 }
00127
00128 void TransactionPreferences::changeShowClearedPreference ( bool state )
00129 {
00130 if ( state == TRUE )
00131 preferences->changePreference ( 3, 1 );
00132 else
00133 preferences->changePreference ( 3, 0 );
00134 }
00135
00136 void TransactionPreferences::changeExcludeTranfersPreference ( bool state )
00137 {
00138 if ( state == TRUE )
00139 preferences->changePreference ( 6, 1 );
00140 else
00141 preferences->changePreference ( 6, 0 );
00142 }
00143
00144 void TransactionPreferences::setDefaultTransactionPreferences ()
00145 {
00146 preferences->changePreference ( 3, 0 );
00147 preferences->changePreference ( 6, 0 );
00148 preferences->changePreference ( 7, 0 );
00149 showclearedtransactions->setChecked ( FALSE );
00150 limittransactions->setCurrentItem ( 0 );
00151 }
00152
00153
00154
00155 AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
00156 {
00157
00158 setCaption( tr ( "Account" ) );
00159
00160 currencysupport = new QCheckBox ( this );
00161 currencysupport->setText ( "Enable Currency Support" );
00162
00163 onetouch = new QCheckBox ( this );
00164 onetouch->setText ( "One Touch Account Viewing" );
00165
00166 if ( preferences->getPreference ( 4 ) == 1 )
00167 currencysupport->setChecked ( TRUE );
00168 else
00169 currencysupport->setChecked ( FALSE );
00170
00171 if ( preferences->getPreference ( 5 ) == 1 )
00172 onetouch->setChecked ( TRUE );
00173 else
00174 onetouch->setChecked ( FALSE );
00175
00176 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
00177 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultAccountPreferences() ) );
00178
00179 layout = new QVBoxLayout ( this, 2, 2 );
00180 layout->addWidget ( currencysupport );
00181 layout->addWidget ( onetouch );
00182 layout->insertSpacing ( 2, 5 );
00183 layout->addWidget ( defaults );
00184
00185 connect ( currencysupport, SIGNAL ( toggled(bool) ), this, SLOT ( changeCurrencySupport(bool) ) );
00186 connect ( onetouch, SIGNAL ( toggled(bool) ), this, SLOT ( changeOneTouchViewing(bool) ) );
00187 }
00188
00189 AccountPreferences::~AccountPreferences ()
00190 {
00191 }
00192
00193 void AccountPreferences::changeCurrencySupport ( bool state )
00194 {
00195 if ( state == TRUE )
00196 preferences->changePreference ( 4, 1 );
00197 else
00198 preferences->changePreference ( 4, 0 );
00199 }
00200
00201 void AccountPreferences::changeOneTouchViewing ( bool state )
00202 {
00203 if ( state == TRUE )
00204 preferences->changePreference ( 5, 1 );
00205 else
00206 preferences->changePreference ( 5, 0 );
00207 }
00208
00209 void AccountPreferences::setDefaultAccountPreferences ()
00210 {
00211 preferences->changePreference ( 4, 0 );
00212 preferences->changePreference ( 5, 0 );
00213 currencysupport->setChecked ( FALSE );
00214 onetouch->setChecked ( FALSE );
00215 }
00216