kplato

kptaccountsviewconfigdialog.cc

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Dag Andersen <danders@get2net.dk>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kptaccountsviewconfigdialog.h"
00021 
00022 #include <qcheckbox.h>
00023 #include <qcombobox.h>
00024 #include <qdatetimeedit.h>
00025 #include <qdatetime.h>
00026 #include <qstring.h>
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     : KDialogBase(Swallow, i18n("Settings"), Ok|Cancel, Ok, p, "Accountsview Settings Dialog", true, true)
00038 {
00039     m_panel = new AccountsviewConfigPanel(this);
00040     m_panel->dateEdit->setDate(date);
00041     m_panel->periodBox->insertStringList(periodTexts);
00042     m_panel->periodBox->setCurrentItem(period);
00043     m_panel->cumulative->setChecked(cumulative);
00044     setMainWidget(m_panel);
00045     
00046     enableButtonOK(false);
00047     
00048     connect(m_panel, SIGNAL(changed(bool)), SLOT( enableButtonOK(bool)));    
00049 }
00050 
00051 
00052 QDate AccountsviewConfigDialog::date() {
00053     return m_panel->dateEdit->date();
00054 }
00055 
00056 int AccountsviewConfigDialog::period() {
00057     return m_panel->periodBox->currentItem();
00058 }
00059 
00060 QString AccountsviewConfigDialog::periodText() {
00061     return m_panel->periodBox->currentText();
00062 }
00063 
00064 bool AccountsviewConfigDialog::isCumulative() {
00065     return m_panel->cumulative->isChecked();
00066 }
00067 
00068 
00069 //----------------------------
00070 AccountsviewConfigPanel::AccountsviewConfigPanel(QWidget *parent)
00071     : AccountsviewConfigurePanelBase(parent) {
00072     
00073     connect(dateEdit, SIGNAL(changed(QDate)), SLOT(slotChanged()));
00074     connect(periodBox, SIGNAL(activated(int)), SLOT(slotChanged()));
00075     connect(cumulative, SIGNAL(clicked()), SLOT(slotChanged()));
00076 }
00077 
00078 void AccountsviewConfigPanel::slotChanged() {
00079     emit changed(true);
00080 }
00081 
00082 
00083 }  //KPlato namespace
00084 
00085 #include "kptaccountsviewconfigdialog.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys