summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/kmymoneyscheduledcalendar.cpp
blob: 4599eb575361ad1187816213dba4a2499e818aa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/***************************************************************************
                          kmymoneyscheduledcalendar.cpp  -  description
                             -------------------
    begin                : Wed Jul 2 2003
    copyright            : (C) 2000-2003 by Michael Edwardes
    email                : mte@users.sourceforge.net
                           Javier Campos Morales <javi_c@users.sourceforge.net>
                           Felix Rodriguez <frodriguez@users.sourceforge.net>
                           John C <thetacoturtle@users.sourceforge.net>
                           Thomas Baumgart <ipwizard@users.sourceforge.net>
                           Kevin Tambascio <ktambascio@users.sourceforge.net>
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

// ----------------------------------------------------------------------------
// QT Includes
#include <tqpushbutton.h>
#include <tqkeysequence.h>

// ----------------------------------------------------------------------------
// KDE Includes
#include <klocale.h>
#include <kpopupmenu.h>
#include <kmessagebox.h>

// ----------------------------------------------------------------------------
// Project Includes
#include "../widgets/kmymoneyscheduledcalendar.h"
#include "../mymoney/mymoneyfile.h"

kMyMoneyScheduledCalendar::kMyMoneyScheduledCalendar(TQWidget *parent, const char *name )
  : kMyMoneyCalendar(parent,name)
{
  TQPushButton *pb1 = new TQPushButton(i18n("Select Schedules"), this);

  kpopupmenu = new KPopupMenu(this);
  kpopupmenu->setCheckable(true);
  kpopupmenu->insertItem(i18n("Bills"), 0);
  kpopupmenu->insertItem(i18n("Deposits"), 1);
  kpopupmenu->insertItem(i18n("Transfers"), 2);
  kpopupmenu->connectItem(0, this, TQT_SLOT(slotSetViewBills()));
  kpopupmenu->connectItem(1, this, TQT_SLOT(slotSetViewDeposits()));
  kpopupmenu->connectItem(2, this, TQT_SLOT(slotSetViewTransfers()));
  kpopupmenu->setItemChecked(0, true);
  kpopupmenu->setItemChecked(1, true);
  kpopupmenu->setItemChecked(2, true);
  pb1->setPopup(kpopupmenu);

  m_scheduledDateTable = new kMyMoneyScheduledDateTbl(this);
  setDateTable((kMyMoneyDateTbl*)m_scheduledDateTable);

  setUserButton1(true, pb1);

  init( TQDate::tqcurrentDate() );

  connect(m_scheduledDateTable, TQT_SIGNAL(enterClicked(const MyMoneySchedule&, const TQDate&)),
    this, TQT_SIGNAL(enterClicked(const MyMoneySchedule&, const TQDate&)));
  connect(m_scheduledDateTable, TQT_SIGNAL(skipClicked(const MyMoneySchedule&, const TQDate&)),
    this, TQT_SIGNAL(skipClicked(const MyMoneySchedule&, const TQDate&)));
}

kMyMoneyScheduledCalendar::~kMyMoneyScheduledCalendar()
{
}

void kMyMoneyScheduledCalendar::slotSetViewBills()
{
  kpopupmenu->setItemChecked(0, ((kpopupmenu->isItemChecked(0)) ? false : true));
  m_scheduledDateTable->filterBills(!kpopupmenu->isItemChecked(0));
}

void kMyMoneyScheduledCalendar::slotSetViewDeposits()
{
  kpopupmenu->setItemChecked(1, ((kpopupmenu->isItemChecked(1)) ? false : true));
  m_scheduledDateTable->filterDeposits(!kpopupmenu->isItemChecked(1));
}

void kMyMoneyScheduledCalendar::slotSetViewTransfers()
{
  kpopupmenu->setItemChecked(2, ((kpopupmenu->isItemChecked(2)) ? false : true));
  m_scheduledDateTable->filterTransfers(!kpopupmenu->isItemChecked(2));
}

#include "kmymoneyscheduledcalendar.moc"