kplato

kptaccountsviewconfigdialog.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2005 Dag Andersen <danders@get2net.dk>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19
20#include "kptaccountsviewconfigdialog.h"
21
22#include <tqcheckbox.h>
23#include <tqcombobox.h>
24#include <tqdatetimeedit.h>
25#include <tqdatetime.h>
26#include <tqstring.h>
27
28#include <kdatewidget.h>
29#include <tdelocale.h>
30
31#include <kdebug.h>
32
33namespace KPlato
34{
35
36AccountsviewConfigDialog::AccountsviewConfigDialog(const TQDate &date, int period, const TQStringList &periodTexts, bool cumulative, TQWidget *p)
37 : KDialogBase(Swallow, i18n("Settings"), Ok|Cancel, Ok, p, "Accountsview Settings Dialog", true, true)
38{
39 m_panel = new AccountsviewConfigPanel(this);
40 m_panel->dateEdit->setDate(date);
41 m_panel->periodBox->insertStringList(periodTexts);
42 m_panel->periodBox->setCurrentItem(period);
43 m_panel->cumulative->setChecked(cumulative);
44 setMainWidget(m_panel);
45
46 enableButtonOK(false);
47
48 connect(m_panel, TQ_SIGNAL(changed(bool)), TQ_SLOT( enableButtonOK(bool)));
49}
50
51
52TQDate AccountsviewConfigDialog::date() {
53 return m_panel->dateEdit->date();
54}
55
56int AccountsviewConfigDialog::period() {
57 return m_panel->periodBox->currentItem();
58}
59
60TQString AccountsviewConfigDialog::periodText() {
61 return m_panel->periodBox->currentText();
62}
63
64bool AccountsviewConfigDialog::isCumulative() {
65 return m_panel->cumulative->isChecked();
66}
67
68
69//----------------------------
70AccountsviewConfigPanel::AccountsviewConfigPanel(TQWidget *parent)
71 : AccountsviewConfigurePanelBase(parent) {
72
73 connect(dateEdit, TQ_SIGNAL(changed(TQDate)), TQ_SLOT(slotChanged()));
74 connect(periodBox, TQ_SIGNAL(activated(int)), TQ_SLOT(slotChanged()));
75 connect(cumulative, TQ_SIGNAL(clicked()), TQ_SLOT(slotChanged()));
76}
77
78void AccountsviewConfigPanel::slotChanged() {
79 emit changed(true);
80}
81
82
83} //KPlato namespace
84
85#include "kptaccountsviewconfigdialog.moc"