00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "kptaccountsviewconfigdialog.h"
00021
00022 #include <QCheckBox>
00023 #include <QComboBox>
00024 #include <q3datetimeedit.h>
00025 #include <qdatetime.h>
00026 #include <QString>
00027
00028 #include <kdatewidget.h>
00029 #include <klocale.h>
00030
00031 #include <kdebug.h>
00032
00033 namespace KPlato
00034 {
00035
00036 AccountsviewConfigDialog::AccountsviewConfigDialog(const QDate &date, int period, const QStringList &periodTexts, bool cumulative, QWidget *p)
00037 : KDialog(p)
00038 {
00039 setCaption( i18n("Settings") );
00040 setButtons( Ok|Cancel );
00041 setDefaultButton( Ok );
00042 showButtonSeparator( true );
00043 m_panel = new AccountsviewConfigPanel(this);
00044 m_panel->dateEdit->setDate(date);
00045 m_panel->periodBox->addItems(periodTexts);
00046 m_panel->periodBox->setCurrentIndex(period);
00047 m_panel->cumulative->setChecked(cumulative);
00048 setMainWidget(m_panel);
00049
00050 enableButtonOk(false);
00051
00052 connect(m_panel, SIGNAL(changed(bool)), SLOT( enableButtonOk(bool)));
00053 }
00054
00055
00056 QDate AccountsviewConfigDialog::date() {
00057 return m_panel->dateEdit->date();
00058 }
00059
00060 int AccountsviewConfigDialog::period() {
00061 return m_panel->periodBox->currentIndex();
00062 }
00063
00064 QString AccountsviewConfigDialog::periodText() {
00065 return m_panel->periodBox->currentText();
00066 }
00067
00068 bool AccountsviewConfigDialog::isCumulative() {
00069 return m_panel->cumulative->isChecked();
00070 }
00071
00072
00073
00074 AccountsviewConfigPanel::AccountsviewConfigPanel(QWidget *parent)
00075 : AccountsviewConfigurePanelBase(parent) {
00076
00077 connect(dateEdit, SIGNAL(changed(QDate)), SLOT(slotChanged()));
00078 connect(periodBox, SIGNAL(activated(int)), SLOT(slotChanged()));
00079 connect(cumulative, SIGNAL(clicked()), SLOT(slotChanged()));
00080 }
00081
00082 void AccountsviewConfigPanel::slotChanged() {
00083 emit changed(true);
00084 }
00085
00086
00087 }
00088
00089 #include "kptaccountsviewconfigdialog.moc"